Need help shading terrain

   5439   6   0
User Avatar
Member
66 posts
Joined: Sept. 2008
Offline
Im making a terrain (grid and sculpt) and im building a shader for it. Just when i finished doing the grass i realized that i needed to add terrain also. So i thought of making a shader with two (or maybe more) colors and blend them using the height of the geometry as a mask or intensity. I'm trying to figure out how get the height of the geometry in VEX and i can't find it. Is this a handful method or there's something better for shading terrains with multi-textures? Maybe using various shaders, but i tried making groups of primitives by painting but the intersections looks very sharp, i prefer something blended.

Thanks for the help

Attachments:
terrain_grass.jpg (23.4 KB)

NicoZ
User Avatar
Member
7737 posts
Joined: July 2005
Online
nzabala
I'm trying to figure out how get the height of the geometry in VEX and i can't find it.

Can't you just use the second component of P? Append a Vector3 to Float VOP to the P output of the Global Variables VOP.
User Avatar
Member
66 posts
Joined: Sept. 2008
Offline
Thanks for the help edward, i tried what you said and work good, but the Y is relative to the camera and when I move it the shader also moves.

Im really new with shaders

Attachments:
Screenshot.png (12.3 KB)

NicoZ
User Avatar
Member
862 posts
Joined: Oct. 2008
Offline
You can also use attributes you created in SOPs in your shaders by accessing them with a parameter node and setting the parameter name equal to the attribute name.
--
Jobless
User Avatar
Member
7737 posts
Joined: July 2005
Online
nzabala
Thanks for the help edward, i tried what you said and work good, but the Y is relative to the camera and when I move it the shader also moves.

Ah right, try inserting a Transform VOP in between the P and Vector to Float. Replace “spacebject” with “space:world”.

Im really new with shaders

Me too.
User Avatar
Member
7737 posts
Joined: July 2005
Online
PS. BTW, I think that you should strive to only have 1 Lighting Model VOP in your network. Use Constant VOPs (type color) for piping into the Mix. Then pipe the output of the Mix into the Lighting Model before piping that to the Output VOP. This way, you can also pipe the F output on your Lighting Model to the corresponding one on the Output VOP.
User Avatar
Member
66 posts
Joined: Sept. 2008
Offline
Thanks for all the advices! They are really useful and I learned a lot. I advanced with my grass/soil shader. I applied the Y value of the P to define if its grass or soil. For now the soil is just a lambert but i will add some noise and variance. I also add a antialiased noise to the union between. It still needs a lot of work buy I want to share with you for helping me a lot to get results. I'll keep you updated

Attachments:
grass_terrain.jpg (133.3 KB)

NicoZ
  • Quick Links