Jump to content

Recommended Posts

Posted

I can code all day, but shaders are honestly a little daunting. I'm wondering if anyone knows of some example shader code that would help me accomplish my goal.

 

Similar to the caustics water shader, I want to apply a texture to a model depending on the angle of the verticies.

 

Does anyone have tutorials or would be able to volunteer for this?

post-214-0-55233300-1330401160_thumb.jpg

Posted

Do you mean the global angle?

So if the object turns the textures are changed?

 

Or local angle of the vertices?

Ali Salehi | Programmer

 

Intel Core i3 2100 @ 3.0GHz | GeForce GTS 450 | 4GB DDR3 RAM | Windows 7 Ultimate x64

LE 2.50 | Visual Studio 2010 | RenderMonkey 1.82 | gDEBugger 5.8 | FX Composer 2.5 | UU3D 3 | xNormal 3.17

 

 

76561198023085627.png

Posted

You can calculate global normal in the "mesh.frag" like this:

 

vec3 g_nml = normal * gl_NormalMatrix;

 

Then you can combine textures based on this global normal.

Ali Salehi | Programmer

 

Intel Core i3 2100 @ 3.0GHz | GeForce GTS 450 | 4GB DDR3 RAM | Windows 7 Ultimate x64

LE 2.50 | Visual Studio 2010 | RenderMonkey 1.82 | gDEBugger 5.8 | FX Composer 2.5 | UU3D 3 | xNormal 3.17

 

 

76561198023085627.png

Posted

Awesome! I appreciate your help, but I wouldn't even know where to start when it comes to shader programming... or combining the texture blend alphas

 

Do you know of an editor / tutorials /examples that could help me accomplish this?

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...