Jump to content

Shader Problem


subabrain

Recommended Posts

Hello Friends,


i have a little Problem again :P


i have a custom shader and want it to be shown at a shape. So i tried the following (in art/shapes/cube/material.cs):

 

singleton Material(cube_GridMaterial)
{
	mapTo = "GridMaterial";
 
	diffuseMap[0] = "grid";
	normalMap[0] = "";
	specularMap[0] = "";
 
	diffuseColor[0] = "1 1 1 1";
	specular[0] = "0.9 0.9 0.9 1";
	specularPower[0] = 0.415939;
	pixelSpecular[0] = false;
 
	shader = BumpCubemap;
 
};
 
new ShaderData( BumpCubemap )
 {
    DXVertexShaderFile     = "shaders/custom/HLSL/Toksvig_NormalMaps.hlsl";
    DXPixelShaderFile     = "shaders/custom/HLSL/Toksvig_NormalMaps.hlsl";
    pixVersion = 1.1;
 };

 

But it doesnt work :/


EDIT: and with the standard shaders it also doesnt work...


Maybe you can help me for that - Thank you very much!


Nice Weekend and Greetings!

Robert

Link to comment
Share on other sites

You need to use singleton CustomMaterial instead of Material. The shader thing is for CustomMaterial only.


I have my ShaderData as singleton. That may be also something you may want to change and I think it's better for that ShaderData to be defined before the CustomMaterial that uses it.



Now that I think about it, I don't recall default templates using any example CustomMaterial. Maybe one should be added as reference in one of the new modules.

Link to comment
Share on other sites

Hello,


sorry im not getting it to work :?


but i will describe what ive done:


first i write the followig material into a cube material (art/shapes/cube/material.cs):

 

singleton CustomMaterial( cubicReflector )  
{   
shader = cubicReflection;  
};

 

and then i go to shaders file (scripts/client/shaders.cs) - and add the following (for example):

 

singleton ShaderData( cubicReflection )  
 {  
    DXVertexShaderFile   = "shaders/common/basicCloudsV.hlsl";  
    DXPixelShaderFile    = "shaders/common/basicCloudsP.hlsl";  
    pixVersion = 2.0;  
 };

 

i know i made something wrong - but where?


Thanks for your patience ;)


Greetings

Robert

Link to comment
Share on other sites

http://www.garagegames.com/community/resources/view/20989


http://www.garagegames.com/community/resources/view/20990


http://www.garagegames.com/community/resources/view/20991


Has a relatively decent writeup. At least on the hlsl side (at time of writing, you'll need additional tweaks and files for the glsl side to support opengl rendering).


For instance,

singleton CustomMaterial( cubicReflector )  
{   
shader = cubicReflection;  
};

 

seems to lack a mapto, which tells the material what entry it's replacing. In addition, it doesn't seem to have any input entries. Those would be sampler["name of variable in your shader file"] = "some texture input" (can be a file or a #textureTarget). Hope that helps.

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.

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