Terrain Material

Terrain Material

Just testing out the new material system. Looks like you can get the height from the state node. From there use gradient nodes and mixer nodes to get a terrain shader.

Only gripe I have is that the island is completely black in 3d view. So, it makes it difficult to align the ocean with the shader in the scene and when I move the lighting I can't get much immediate feedback.

Also, it would be nice if I could group nodes together because things turn into spaghetti really fast in the node editor.

Sure it could be more detailed but I'm just doing a learning exercise.
 

Attachments

  • island.jpg
    island.jpg
    22 KB · Views: 1,128
Last edited:
Interesting. But one problem I'm running into is there seems to be no math function to normalize a vector. I see norm but I think thats something else? Also, how can I clamp values to a range? Say [0,1] for instance. I was feeding values into mix but at the extreme it would put neon colors there. I guess it was out of the 0 to 1 range. :) If I used modulo then its like someone sand papered it. :)

Also, if I edit in another material, it would be cool if I could copy nodes then switch into another material and paste the nodes. Better yet, a new node type I can reference other materials as inputs? That way I would not have to recreate granite for instance?

Things get complicated. It would be nice if I could pass color through a node and the node would simply render one of those sphere icons at that stage. That way, I could see what is going on at different stages.

Pretty fun.
 
Here is the improved terrain using some slope stuff. Just for kicks I attached the node graph ... spaghetti!
 

Attachments

  • alpine.jpg
    alpine.jpg
    45.5 KB · Views: 1,034
  • nodes.jpg
    nodes.jpg
    76.9 KB · Views: 1,043
Here is the improved terrain using some slope stuff. Just for kicks I attached the node graph ... spaghetti!

Lovely render and good work. Although, I have to say, just to achieve that effect, you could do this much faster using a good texture image and bump map. That node system is proving my point about the number of steps involved. How much time did this take?
 
Lovely render and good work. Although, I have to say, just to achieve that effect, you could do this much faster using a good texture image and bump map. That node system is proving my point about the number of steps involved. How much time did this take?

Robert you're probably right about this particular terrain BUT with procedural you can make a single material that fit any terrain (of the same kind) you'll make in the future... that costs you a bigger effort for sure but once it's done you can use it forever (and you can even share your mats with other Cheetah user...)

for sure i'm not able to create this terrain material right now but i can still use the "old" texture+bumpmap approach as long as i want (yes, with a few more clicks than before...)

i know what's your (first?) opinion about that and i'm not trying to convince you but i'm sure it is worth the effort... it's like jumping from raster to vector image in my mind :smile:

the only thing i'd suggest to Martin is to create some kind of partial preview (for each node or, at least, for the most important - see example in attached screenshot) so that we can see what's happening as we tweak the parameters... this should be done as soon as he can in my opinion 'cause it's a definitely must have to let us consciously play with it :smile:

just my thought, btw

Cheers,
A
 

Attachments

  • NodeEdit.jpg
    NodeEdit.jpg
    138.9 KB · Views: 1,014
Pretty cool Frank. The possibilities are endless!

Alvordr, making custom materials is an involved process.

For instance, in Carrara, there are more than a dozen pre packaged terrain shaders. In that case, I simply drag drop, tweak and bake a texture. I guess now I can do it in Cheetah and not spend time exporting all my models and dealing with all the problems that arise from exporting. Also, Carrara did not have a bake function and I had to buy one from a third party. ( every time they update Carrara it breaks it too) Give Cheetah some time and soon there will be dozens of shaders out there to do nearly anything. It took an afternoon to do but my main intention was to learn the new materials system. Now that I have a better idea, I can do it faster and build up my library of shaders.

Its a .0 release. Did you not expect there to be kinks initially? Moreover, I can still do exactly what you said in Cheetah. What if you can't find the texture you are looking for?

When detecting the side of the mountain, I take the dotproduct. The dotproduct of two normalized vectors should return [-1,1]. So, I take the abs of the normal to get [0,1] range which I can pass. Since its in these ranges then doing an exponent or multiply will adjust how its applied to the sides. Though, if I take the dot product I think I need to normalize the second vector where I set y to zero. I was not sure how to do that. I see there is a norm function but I'm not sure its for vectors.(?) But even without normalizing, it looked close enough -- might be where the purple in the icon image is coming from.

I think it would be cool if I could pass the color through some kind of levels function. eg. like levels in Graphic converter. It could help remove the chalky pastel color. Or maybe there is a way to do that?
 
Last edited:
Frank, I see your shader does a tangent on the bump map input. That really enhances it.

I noticed too that in the gradient node one can double click to get another setting. And clicking on it brings up a color choice. Was not apparent at first.
 
Pretty cool Frank. The possibilities are endless!

Alvordr, making custom materials is an involved process.

For instance, in Carrara, there are more than a dozen pre packaged terrain shaders. In that case, I simply drag drop, tweak and bake a texture. I guess now I can do it in Cheetah and not spend time exporting all my models and dealing with all the problems that arise from exporting. Also, Carrara did not have a bake function and I had to buy one from a third party. ( every time they update Carrara it breaks it too) Give Cheetah some time and soon there will be dozens of shaders out there to do nearly anything. It took an afternoon to do but my main intention was to learn the new materials system. Now that I have a better idea, I can do it faster and build up my library of shaders.

Its a .0 release. Did you not expect there to be kinks initially? Moreover, I can still do exactly what you said in Cheetah. What if you can't find the texture you are looking for?

When detecting the side of the mountain, I take the dotproduct. The dotproduct of two normalized vectors should return [-1,1]. So, I take the abs of the normal to get [0,1] range which I can pass. Since its in these ranges then doing an exponent or multiply will adjust how its applied to the sides. Though, if I take the dot product I think I need to normalize the second vector where I set y to zero. I was not sure how to do that. I see there is a norm function but I'm not sure its for vectors.(?) But even without normalizing, it looked close enough -- might be where the purple in the icon image is coming from.

I think it would be cool if I could pass the color through some kind of levels function. eg. like levels in Graphic converter. It could help remove the chalky pastel color. Or maybe there is a way to do that?

Hey Bugaboo,

I agree that not having to go to another app to create procedural shaders or baking is a good thing. My concern was mainly that the nodal system replaced what I had already been using. Now, I'm simply guessing all over the place at how to get the effect I could more easily do before. Building a shader library is useful, no doubt. I would have preferred to have the nodal system be in place, with no changes to the existing material system from before. Just my taste.
 
I had to have a go at this (I tried during beta but was never happy with my results). Here's the texture map I ended up with (more-or-less)... The renders were actually made using the "verticalness" norm directly for color mixing (instead of the fourth power) which produced a more pronounced effect (snow not clinging to verticals).

Terrain%20Shader.png


You may note in the mountain closeup that I'm not using the verticalness measure to modify the specular mix, which would improve things somewhat since the rocks above the snow line shouldn't be so shiny.
 

Attachments

  • afternoon.jpg
    afternoon.jpg
    49.6 KB · Views: 715
  • mountain detail.jpg
    mountain detail.jpg
    34 KB · Views: 692
I think using the crossproduct is easier. I suppose what is happening here is the closer the normal gets to the horizontal plane, the more orthogonal things get. When it hits 90 degrees you end up with a 1 for the magnitude -- sine of 90 is 1. Since the magnitudes are normalized its just sine. When I was doing the dotproduct, it was using cos of the angle instead. 90 degrees phase shifted -- I would have my mix the other way around. :)

I was messing around putting the gradient in for the power function. If you control click on the widgets it gives different options for it. eg. cubic, liner or step. I suppose if the power function is a multiple of two then you don't need an abs for the sign.

Pretty fun. :smile:
 
I wish the people who taught me vector algebra in first year math had been able to explain it halfway decently. It's taken me a LONG time to get an intuitive handle on what the operations mean geometrically.

Of course if we'd had interactive 3d software to play with back then it would have been much easier.
 
This look amazing! I wish i had 5.0...

I wish the people who taught me vector algebra in first year math had been able to explain it halfway decently. It's taken me a LONG time to get an intuitive handle on what the operations mean geometrically.

Of course if we'd had interactive 3d software to play with back then it would have been much easier.

School is terrible, I wish they would involve more stuff like this.

It's funny that with 10.6, briefly before C3D came out, they upgraded the graphics of the official Mac OS X node system.
 
terrain material for dummy

dear bogaboo, frank and/or podperson,
can you show me how you set the gradient properties of terrains you've made, or explain how it works? i got the basic idea of the heigh-related color using State/Vec2Float/Gradient nodes but i miss the proportions between the geometry of the model and the gradient scale (and the absence of preview does't help...)
I'm not trying a terrain but a partially rough water plane, where the gradient should govern the transparency of the water, giving the difference between the 100% transparent calm water and the 10-20% where it's troubled and gets white. I think a subdivided plane with displacement and a height-related-semi-transparent material should work, but i'm fooling around with parameters :confused:
this could probably be done with noises or greyscale images applied to the bumpmap, transparent and reflection channels but i wish i could try both solutions before choosing what's the best...

thanks in advice,
regards,
Alessandro
 
Its real easy. Just make the gradients a gray scale color. So, the gradients output goes into a mix node. The mix node has an input mix which ranges [0,1]. Since the gradient is gray scale its output is [0,1] too. If its black then it chooses one color in the mix or white chooses the other color. If its gray then its going to mix the colors together.

Double clicking on the gradient color band creates another widget. If you control click on the little widgets a popup menu appears. The popup gives you some control over how the colors in the gradient are blended.

With regard to the terrain stuff, the more narrow the color change is the harder the edge will be on the terrain. For instance, the sand on my island has a harder edge.

I'm sure you could use colors too. In that case, I suppose I could pass the gradients output into a v3c2float node and use the x,y,z (r,g,b) separately for different mix nodes.

Its a nice way to soften edges and control a mix. If you put a constant into the mix you'll probably get a hard edge.

It does not have to be just height going into the gradient. It could be steepness or any other values too. But its a nice way to shape the output into the mix nodes mix input.

Hope that helps. :)
 
Caps on the water. Hmm, that would probably be a tangent slope kind of deal. If the normals approach vertical then mix in your water white caps image or whatever procedural you make to render white caps. That is what podperson is talking about with the crossproduct stuff. But the problem would be the color the low portions of the chop. You need to find the maxima I suppose where the slope increases then decreases.

Aside, If I were writing a fragment shader to do water, then I would examine the depth value at the fragment before I calculated the color. Somehow, compare the water height at that fragment to the depth value of the terrain at that fragment. Would have to line it up with the eye vector. Find the difference and that would be the transparency. Not sure how to do that in this system. Its doing its ray trace thing.

The height is the y position in the model.

Maybe another approximation is to have an image input that is a height map of the terrain. From there you might compare the gray scale height map to the height of the y position. You might be able to produce an approximation of the depth. Though, the true depth would be along the eye to the point where its drawing.

Thinking about it some more, you could create a normal map too and import the image and use that. Sometimes, I would throw in a height map into the alpha channel -- that way I could save memory in OpenGL. But I think Mac OS premultiplies alpha on everything so that would not work ... have to avoid quartz to do that. :)

Hope that helps.
 
Last edited:
Going on tangents... Funny idea, render the scene only with fog. Save the image. Now, import the image and you have the depth assuming the camera does not move. Maybe from that I could control the transparency of the ocean close to the terrain model.
 
dear bogaboo, frank and/or podperson,
can you show me how you set the gradient properties of terrains you've made, or explain how it works? i got the basic idea of the heigh-related color using State/Vec2Float/Gradient nodes but i miss the proportions between the geometry of the model and the gradient scale (and the absence of preview does't help...)

It's a pretty simple cheat. You're using the object's local space, so 0 = bottom of gradient, 1 = top of gradient -- adjust the mesh until it looks right.

[/quote]I'm not trying a terrain but a partially rough water plane, where the gradient should govern the transparency of the water, giving the difference between the 100% transparent calm water and the 10-20% where it's troubled and gets white. I think a subdivided plane with displacement and a height-related-semi-transparent material should work, but i'm fooling around with parameters :confused:
this could probably be done with noises or greyscale images applied to the bumpmap, transparent and reflection channels but i wish i could try both solutions before choosing what's the best...[/quote]

For this kind of thing, the actual geometry of the water is irrelevant -- it can be a flat plane -- 2 triangles. Your height input data becomes a procedural texture (turbulence say) and you want white to be the "highest" part and black to the the "lowest" part (black = 0, white = 1). Now imagine you have a texture that varies from faintly blue to white (with a pretty sudden transition) -- map height to that gradient for diffuse color.

Now another texture varies from white (transparent) to dark grey (nearly opaque) -- a copy of the previous gradient with the colors replaced. That's your transparency channel.

You could also use that as your roughness channel for reflection.

I'm on my PC -- gimme a few minutes and I'll post an example from my Mac.

Edit: attached a quick attempt. Definitely needs work.
 

Attachments

  • ocean.jas.zip
    7.5 KB · Views: 401
Last edited:
Back
Top