PDA

View Full Version : Make Material node suggestion



jrandom
02-09-2010, 10:56 AM
It would be immensely useful if the Make Material node included a Bump input. As it stands, if I'm mixing materials and want one of them to be created with the Make Material node, there's no way to have a bump map on that particular material.

If such a thing does not exist, how difficult would it be for me to write a plugin/node that does this? I have years of C/C++ experience, but have no idea what would be involved in creating a new node that replicates Make Material with a Bump input added.

Sensei
02-09-2010, 11:20 AM
It's not possible to write such node (there is no sense in it).
Bump channel must be applied to sources for each Diffuse, Specular, Reflection and Refraction channels. In Make Material it's simply too late for normal vector modification.

jrandom
02-09-2010, 11:31 AM
It's not possible to write such node (there is no sense in it).
Bump channel must be applied to sources for each Diffuse, Specular, Reflection and Refraction channels. In Make Material it's simply too late for normal vector modification.

I don't really understand this. Other material nodes have a Bump input. Say I wanted to use a mask to blend two different materials. One could be a Delta material w/ bump map, but if I wanted the other material to be a Make Material node, there's no way to apply a bump map to it. Surely it must be possible to have a Bump input that is passed along just like the other material nodes?

I ran into this issue when making this crazy object (http://www.newtek.com/forums/showthread.php?t=106242) where I wanted to use the Dielectric material as one input and a Make Material as the other (mixing them via Material Mixer). Because I was unable to apply Bump to the Make Material, I had to use discard the Dielectric material and just use normal shaders across the board, mixing the bump maps separately and feeding them into the Bump input for the Surface node.

Edit: Meant 'dielectric', not 'delta' node, updated.

jrandom
02-09-2010, 11:34 AM
To clarify: the Surface node takes in the Diffuse, Specular, etc... shaders, and applies a seperate Bump input to them. The Make Material node has the same shader inputs, so why can it not apply a Bump input the same way the Surface node does?

(I love the material nodes, but sometimes I just can't get the look I want with them the same way I can using the Shader nodes. I find it really useful to be able to mix different materials, so I'll be running into many cases where I'd like to mix in a Make Material node that has a bump map.)

Sensei
02-09-2010, 11:43 AM
Make Material just copy Diffuse, Specular, Reflection, Refraction and Transparency to material structure:

typedef struct LWNodalMaterial_t {
LWDVector diffuse;
LWDVector specular;
LWDVector reflection;
LWDVector refraction;
double transparency;
} LWNodalMaterial;

It's defined in LWSDK\include\lwnodes.h
Material is just 13 doubles.



I ran into this issue when making this crazy object where I wanted to use the Delta material as one input and a Make Material as the other (mixing them via Material Mixer). Because I was unable to apply Bump to the Make Material, I had to use normal shaders instead, mix the bump maps separately and feed that into the Bump input for the Surface node.

Why not just put bump to Delta node bump input, or normal?

Sensei
02-09-2010, 11:51 AM
After sending such structure to LW, there is done following math to calculate final RGB color:


void CTHPreviewShader::Flatten( void )
{
ENTER( "CTHPreviewShader::Flatten()" );

CVector output_color;
output_color = GetDiffuseShading();
double transparency = GetTransparency();
if( transparency != 0.0 )
{
output_color *= 1.0 - transparency;
output_color += GetRefractionShading() * transparency;
}
output_color += GetSpecularShading();
output_color += GetReflectionShading();
SetOutputColor( output_color );

LEAVE( "CTHPreviewShader::Flatten()" );
}

Normal (and bump) calculation is very early process, done immediately after ray hits polygon.

Lightwolf
02-09-2010, 12:07 PM
Sensei is right, the material output is basically a combination of shaded components.
The shading is the result of the respective settings and already includes the effect of the bump map.

What you can do with a material mixer/blender whatever is combine to materials who shading has been computed using a bump map.

I'm not familiar with your node tree, but a standard material as the other input should work just fine.

One issue does make the whole thing a bit more opaque: the LW Node Editor passes some data around to nodes without there being a connection. So it may use some data that you haven't explicitly connected to them (normals, bumps, etc...).

Can you post a screenshot of your node tree?

Cheers,
Mike

jrandom
02-09-2010, 12:24 PM
Why not just put bump to Delta node bump input, or normal?

The Delta material was fine (I would be using it for the glassy black material in the above link I posted). I wanted to mix it with a Make Material node (used for the rough, non-glossy surface), but since I was unable to apply a bump map to it, I was unable to achieve the result I wanted via Materials and had to fall back to mixing the shaders that I hooked up to the Surface node directly.

I guess my confusion comes from the fact that the Surface node seems to be able to take shader inputs and apply a bump map to them via the Bump input, so I'm confused as to why the Make Material cannot do this the same way the Surface node does.

Curse my ignorance! :confused:

(I was trying to use Make Material because of the rough look I was able to get via OrenNayer diffuse and CookTorrence specular. I couldn't figure out how to achieve that same appearance using the Delta material -- I can't seem to replicate the look of the the CookTorrence specular shader node with it.)

jrandom
02-09-2010, 12:32 PM
Sensei is right, the material output is basically a combination of shaded components.
The shading is the result of the respective settings and already includes the effect of the bump map.

Light is slowly dawning. I'm an extreme Lightwave newbie and sometimes it feels like I'm trying to run an obstacle course while blindfolded.


What you can do with a material mixer/blender whatever is combine to materials who shading has been computed using a bump map.

I'm not familiar with your node tree, but a standard material as the other input should work just fine.

See my above post about the CookTorrence specular shader look I was trying to replicate.


One issue does make the whole thing a bit more opaque: the LW Node Editor passes some data around to nodes without there being a connection. So it may use some data that you haven't explicitly connected to them (normals, bumps, etc...).

Why those sneaky bastards! :)


Can you post a screenshot of your node tree?

It's included in the file I posted in this thread (http://www.newtek.com/forums/showthread.php?t=106242).
Edit: I'll be able to take a screenshot of it when I get home today.

I was originally trying to make the ridges have a glassy, dark, obsidian look with a fair amount of absorption via the Dielectric material, with the rest of the object having that rough look of pummeled dust (which I failed to achieve with the Delta material but could easily make with the regular shader nodes).

Instead, I had to use regular shaders for the ridges instead of the beautiful glassy materials I can make with Dielectric.

Lightwolf
02-09-2010, 03:00 PM
It's included in the file I posted in this thread (http://www.newtek.com/forums/showthread.php?t=106242).
Edit: I'll be able to take a screenshot of it when I get home today.

Thanks. I've just wondered on how you tried to actually use the make material node in the first place, and that's not a part of the scene file.

In your surface you can even see how the bump propagates up to the Cook-Torrance node, even that node actually has nothing connected to the bump input.

Cheers,
Mike

jrandom
02-09-2010, 04:59 PM
Thanks. I've just wondered on how you tried to actually use the make material node in the first place, and that's not a part of the scene file.

The object file is also included in the .zip file, but I'll still post a screencap later today.

Lightwolf
02-09-2010, 06:15 PM
The object file is also included in the .zip file, but I'll still post a screencap later today.
Well, I did load the scene with the object ;) - I still don't know what you were specifically referring to.

Cheers,
Mike

dwburman
02-09-2010, 08:58 PM
Can't you just mix the bumps separately as you're already doing and plug them into the bump input?

I did a little test using a simple grid bump texture. I tried it with your surface settings and then I plugged in the car paint material into the material channel.

Am I missing something? Do the material nodes actually do anything to bump channel other than passing it through?

jrandom
02-09-2010, 09:22 PM
Can't you just mix the bumps separately as you're already doing and plug them into the bump input?

I did a little test using a simple grid bump texture. I tried it with your surface settings and then I plugged in the car paint material into the material channel.

Am I missing something? Do the material nodes actually do anything to bump channel other than passing it through?

?

...

!! Of course! Now that I know that the bump input passes back bump information to the shaders... it all makes sense now!

It's still not quite as cool as having the bump information passed through the material itself as it can potentially complicate the node structure for bump mixing, but yes!

IT! COULD! WORRRK! </frahnkoohnsteen>