PBR node tree

Hello everyone,
Currently I am working on building a new node editor in which I would make textures (base, specular, metallic, normal, roughness, bump…).
I have made about ten new nodes:

I have a problem. The saving and loading of blender file doesn’t work. I looked inside files readfile.c and writefile.c, but I am losing too much time on that - I can’t figure it out. In the structure Scene I have added a new field - struct PBRTexture *pbr_texture. How can I save and load this structure from blender file?
Thanks in advance.

10 Likes

OMG seeing displayed textures in the node editor and more procedurals is like a dream come true! Hope you’ll solve the problem and get this implemented as soon as possible!
Out of curiosity, is it meant to be implemented in the Shader Editor or to be a substitute of the Texture Node Editor?
Good job!

Hi,
In PBR node editor there is a node “PBR output” that has created textures (base, specular, metallic, normal, roughness, bump…). In shader editor there is a new node “PBR texture” that has those maps as output, which we connect later to the node “Principled BSDF”. I have already done all of this.

1 Like

I like it, but it’s not the same that actual texture editor?

I see, can I politely ask why there is the need for a separate editor instead of adding them to the shader editor?

We are planning to improve texture datablocks in Blender to use the same nodes as shading nodes.
https://developer.blender.org/T54656

An additional “PBR texture” node system doesn’t fit in with that design, we want to avoid having multiple texture systems.

As for file/saving loading, look at how a similar data structure is implemented and copy it? For example the compositor nodes that are also stored in the scene. Storing textures in a scene is not ideal though.

3 Likes

No, that’s a new editor.
It is not possible to implement this into shader editor. Nodes in shader editor use glsl functions, instructions are sent directly to the graphic card. Because of that I cannot see the preview. This new editor uses processor as composite editor.

2 Likes

@dandy025 Seeing your displayed thumbnails and noise textures could this actually be something that you can contribute to the shader editor? These belong to very popular Right Click Select topics.

An additional node system just for PBR textures seems to be way to much in my opinion.

3 Likes

in
"write_scene(WriteData *wd, Scene *sce) " add

if (sce->pbr_texture) {
write_pbrtexture(wd, sce->pbr_texture);
}

and add new func

static void write_pbrtexture(WriteData *wd, PBRTexture tex)
{
if (tex->id.us > 0 || wd->use_memfile) {
/
write LibData */
writestruct(wd, ID_PBR, PBRTexture, 1, tex);
write_iddata(wd, &tex->id);

/* nodetree is integral part of pbrtexture, no libdata */
if (tex->nodetree) {
  writestruct(wd, DATA, bNodeTree, 1, tex->nodetree);
  write_nodetree_nolib(wd, tex->nodetree);
}

write_previews(wd, tex->preview);

}
}

Update on this:
This project is basically a copy of Texture datablock. I have opened a new one only for developing new nodes, because I didn’t want to change the code from source datablock. All of this would be later transferred to texture node editor.

3 Likes