Game Development Community

Shaders in torque

by Sean Crooks · in Torque Game Engine Advanced · 05/24/2005 (7:36 am) · 5 replies

Hi

Im currently trying to take shaders i have created in rendermonkey and use them within tse but i am coming across many problems. Mainly being i just cant get the shaders to display.

Ive used the tutorial on here about porting them over but still cant get them to work within the engine.

Is there an easy way to get shaders into the engine? or can someone point out the process needed to import our own shaders?or any resources? is there a better shader tool to use with torque other as opposed to rendermonkey?

Cheers
Dave

#1
05/24/2005 (2:55 pm)
Ive used both rendermonkey and nvidia's fxcomposer...both work just fine. ati's rendermonkey is a bit closer keeping the pixel and vertex shaders separate like TSE so the port isnt too difficult, but the .fx files are easy to break up. Would be nice if TSE eventually supported the .fx format, but that's got it's own issues...

Start very simple, like copy/paste from the simple diffuse shader, ensure that works for you and match up from there. A big help is looking into the constants file in the TSE source to get matched up with the correct registers. Other than that, apply like any other custom material. Took me a couple tries at first, but once you get it hooked up and create a template to work from development is fast.

Search around the forums for creating custom parameters for your shaders...or it may be a resource. That write up is very helpful in how the mapping process happens.
#2
05/24/2005 (3:17 pm)
Maybe This.

You will need to own the SDK to make shader specific changes to the registeries. There Should be a post in the Private section describing how to do so.
#3
06/01/2005 (5:54 am)
Hi again, the problem we are having is the shaders we are using from rendermonkey are in ASM is there any easy ways to convert it over to hlsl or is the only way to try work out what everything is doing? and write it up ourselves?

Cheers
#4
06/01/2005 (6:00 am)
Never played with Assembly Shaders sorry.
#5
06/01/2005 (7:07 am)
The assembly version should compile in and run if you got it matched up with the way TSE fills and accesses the registers. Run TSE in debug mode using VS and the compiler will break on error and give you a line number in your shader file if it isnt compiling properly. This is helpful and the final step to porting over shaders from another IDE

Your other option is to do the assembly -> hlsl conversion yourself...the assembly language is not difficult but takes some time to learn if you havent messed with assembly before. Also, dig around a bit: many of the ASM shaders have a hlsl/glsl version around either on ATI's/Nvidia's site or somewhere on the web.

Keeping the shader ASM is probably best. Really depends on the compiler and your target VS/PS.