Jump to content

Multiple Textures applied via Shader


Rekindled Phoenix
 Share

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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.

 Share

×
×
  • Create New...