Home Technical Talk

HLSL shader -> Max .. tiling?

TSM
TSM
Hey guys,

I'm learning HLSL using Ben's DVD series (great stuff!) and I am using a shader I wrote for normal maps, diffuse, and specular and brought it into Max. It would great but I would love to use this for terrain so it needs to tile. Is there a MAX function that I can just type into my shader to allow for that?

Or maybe there is a document that Autodesk provides has this - but I couldn't find it.

I tried to try to use the standard max material (since it can tile) to affect the shader but to no avail - I just ran out of ideas.

Thanks!

TSM

Replies

  • CrazyButcher
    Options
    Offline / Send Message
    CrazyButcher polycounter lvl 18
    multiply the texcoords before sampling (tex2D(..)), performance wise it's often more optimally to multiply in the vertexshader.
    // create a float variable outside the main function of vertexshader
    // it will get a ui spinner widget in which you can adjust tiling
    
    float tileScale
    <
    	string UIType = "FloatSpinner";
    	float UIMin = 0.01;
    	float UIMax = 100.0;
    	float UIStep = 0.01;
    	string UIName = "tile scale";
    > = 1.0;
    
    ...
    
    // somewhere in vertexshader you would do
    // of course might look different depending on the
    // naming of structs for input/output and so on.
    
    OUT.texcoordTiled = IN.texcoord * tilescale;
    
  • TSM
    Options
    Offline / Send Message
    TSM
    Works pefectly! Thanks!!
Sign In or Register to comment.