Jump to content

Recommended Posts

Posted

I'm currently prototyping some procedural mesh algorithms and I'd like to apply tri-planar texturing to my meshes. I'm wondering if LE2 has a tri-planar texturing shader available already or whether I need to create my own?

 

If I need to create my own, I'd love some guidance on how I, in C++, apply a shader to my Mesh objects as well as pass textures and the mesh object properties to the shader.

 

Thanks.

Programmer, Modeller

Intel Core i7 930 @ 3.5GHz | GeForce 480 GTX | 6GB DDR3 RAM | Windows 7 Premium x64

Visual Studio 2008 | Photoshop CS3 | Maya 2009

Website: http://srichnet.info

Posted

Hey,I think there isn't a shader for that stuff here,but I can tell you how to assign a shader to a mesh:

 

First load a mesh (without materials)

TEntity mesh = LoadMesh("");

 

Then you load a material with your shader and assign it:

MAT File:
texture0="abstract::blah.dds"
shader="abstract::your_shader.vert","abstract::your_shader.frag"
LOAD:
TMaterial mat = LoadMaterial("abstract::mymaterial.mat");
PaintEntity(mesh,mat);

 

And get the Shader from the material for adjusting:

 

TShader shader = GetMaterialShader(mat);
SetShaderFloat(shader,"myuniformvariable",0.0f);
//or
void SetShaderFloat(TShader shader, str uniform, float x )
void SetShaderFloatArray(TShader shader, str name, flt* ar, int count=1)
void SetShaderVec2(TShader shader, str uniform, TVec2 v )
void SetShaderVec3(TShader shader, str uniform, TVec3 v )
void SetShaderVec4(TShader shader, str uniform, TVec4 v )
void SetShaderInt(TShader shader, str uniform, int i )
void SetShaderIntArray(TShader shader, str name, int* ar, int count=1)
void SetShaderMat3(TShader shader, str uniform, mat3 mat )
void SetShaderMat4(TShader shader, str uniform, mat4 mat )

 

I hope it helps a little bit ;)

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...