subabrain Posted April 29, 2017 Posted April 29, 2017 Hello Friends,i have a little Problem again :Pi 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 Quote
irei1as Posted April 29, 2017 Posted April 29, 2017 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. Quote
subabrain Posted April 29, 2017 Author Posted April 29, 2017 Hey,thanks alot ... ill try ;)greetzRobert Quote
subabrain Posted April 29, 2017 Author Posted April 29, 2017 Hello again,i found something really cool:https://www.beamng.com/threads/how-to-make-a-parallax-occlusion-mapping.9709/here a screenshot from my own:http://i.imgur.com/TmhPfC6.jpgso i dont have to use custom hlsl shaders for this :)gn8Robert Quote
Duion Posted April 30, 2017 Posted April 30, 2017 So you want to do parallax mapping? That works by default in Torque, though not very nicely and costs lots of performance. Quote
subabrain Posted April 30, 2017 Author Posted April 30, 2017 Hello,okay i see... but all shaders i tried where "fx" and not "hlsl" - which shaders i can use for t3d?thanks a lot and nice day ;)EDIT: Sorry - i found this now:http://www.garagegames.com/community/forums/viewthread/96607Sorry for asking :roll: greetzRobert Quote
JeffR Posted April 30, 2017 Posted April 30, 2017 Heh, no worries, can't get help if you don't ask any questions, after all ;) Quote
subabrain Posted May 1, 2017 Author Posted May 1, 2017 Good Morning,thanks for your post JeffR! But i still dont get it to work - is there any example hlsl?i dont know why, but it still isnt working.sorry for this question but i dont get it to run :/greetings an nice sunday!Robert Quote
Timmy Posted May 1, 2017 Posted May 1, 2017 You must use the new macros created for use with Direct3D11 https://github.com/GarageGames/Torque3D/blob/development/Templates/Full/game/shaders/common/shaderModel.hlsl .. check through any of the hlsl shaders in that directory for an example of how to use them. Quote
subabrain Posted May 1, 2017 Author Posted May 1, 2017 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 ;) GreetingsRobert Quote
Azaezel Posted May 1, 2017 Posted May 1, 2017 http://www.garagegames.com/community/resources/view/20989http://www.garagegames.com/community/resources/view/20990http://www.garagegames.com/community/resources/view/20991Has 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. Quote
subabrain Posted May 1, 2017 Author Posted May 1, 2017 Hi,yes thats it - thank you very much! :)greetsRobert Quote
subabrain Posted May 3, 2017 Author Posted May 3, 2017 Hello again,its all right - but what exactly is "mapto" - theres no info about ...maybe u can explain - would be nice :)greetingsRobert Quote
Azaezel Posted May 3, 2017 Posted May 3, 2017 mapto: the material slot namehttp://imgur.com/a/klpPz Quote
subabrain Posted May 3, 2017 Author Posted May 3, 2017 A okay i see - THX VERY MUCH!GreetsRobert Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.