Jump to content

Use special shader in Unigine


photo

Recommended Posts

Hi all

I am a newer user in this forum, and i design shaders for games, i want to use my special shader in Unigine, i wrote that in HLSL format.

How can i import fx file in Unigine?

 

Thanks

Link to comment

How can i import fx file in Unigine?

 

there is no easy import of an fx file as UNIGINE uses a different shader concept. Have a look into documentation "Content Creation\Materials Overview\How to Create a New Material" for more infos.

 

You will find UNIGINE material definitions in subdirectory data/core/materials and shaders in data/core/shaders

  • Like 1
Link to comment

there is no easy import of an fx file as UNIGINE uses a different shader concept. Have a look into documentation "Content Creation\Materials Overview\How to Create a New Material" for more infos.

 

You will find UNIGINE material definitions in subdirectory data/core/materials and shaders in data/core/shaders

 

Thank you ulf.schroeter, i saw a notice on the documentation like this:

 

"Unigine extensions can be divided into three types depending on the interface to be used:

 

//C++ API (components in C++)

Material system (shaders in GLSL/HLSL)

//Interpreter (scripts in UnigineScript) "

 

so you think i can not use HLSL format in Unigine directly?

Link to comment

so you think i can not use HLSL format in Unigine directly?

As UNIGINE supports different rendering systems (OpenGL, D9/10/11, PS3) each shader definition file actually includes different language versions of the same functionality.

 

/* Copyright (C) 2005-2010, Unigine Corp. All rights reserved.
* .....
*/

#ifdef OPENGL

....
void main() {
...
}

/******************************************************************************\
*
* Direct3D9
*
\******************************************************************************/

#elif DIRECT3D9

...
VERTEX_OUT main(VERTEX_IN IN) {
...	
}

/******************************************************************************\
*
* Direct3D10/Direct3D11
*
\******************************************************************************/

#elif DIRECT3D10 || DIRECT3D11

...
VERTEX_OUT main(VERTEX_IN IN) {
...
}

/******************************************************************************\
*
* PlayStation3
*
\******************************************************************************/

#elif PLAYSTATION3

...
VERTEX_OUT main(VERTEX_IN IN) {
...
}

#endif

 

For DirectX9/10/11 HLSL format is used, so you can put your existing HLSL code into the DX #ifdef sections. If you also want to support OpenGL/PS3 you have to provide also shader code versions in GLSL/PS3 dialect.

  • Like 1
Link to comment
×
×
  • Create New...