(Solved)Question about BlendOperation(SOLVED)

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
CuteAlien
Admin
Posts: 9634
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Question about BlendOperation

Post by CuteAlien »

You set the shadingLanguage to video::EGSL_CG, but then pass a hlsl shader.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Question about BlendOperation

Post by The_Glitch »

Hmm Interesting never saw that, I changed it to

Code: Select all

video::EGSL_DEFAULT 

Sadly It changed nothing though.
juanjpro
Posts: 12
Joined: Mon Nov 24, 2014 12:54 pm

Re: Question about BlendOperation

Post by juanjpro »

--Edit: forget about this, I misunderstood everything--
HLSL doesn't work with OpenGL. Either change your driver type to EDT_DIRECT3D9, or use this GLSL equivalent to saturation.hlsl (I'm not sure if this will work):

Code: Select all

//saturation_vertexShader.vert
 
uniform mat4 matViewProjection;
 
varying vec2 texCoord;
 
void main(void) {
    gl_Position = matViewProjection*gl_Vertex;
    texCoord = gl_MultiTexCoord0.xy;
}

Code: Select all

//saturation_fragmentShader.frag
 
uniform sampler2D TextureSampler;
 
varying vec2 texCoord;
 
void main(void) {
    vec4 Color = texture2D(TextureSampler, texCoord);
    gl_FragColor = clamp((Color - 0.3) / (1.0 - 0.3),0.0,1.0);
}
Then you'll need to specify the paths of the new shaders:

Code: Select all

//don't use absolute paths
psFileName4 = "saturation_vertexShader.vert";
vsFileName4 = "saturation_fragmentShader.frag";
 
video::IGPUProgrammingServices* gpu = driver->getGPUProgrammingServices();
 
s32 saturation_pass = video::EMT_SOLID;
 
if (gpu)
{
    Saturation_Shader* mc_12 = new Saturation_Shader();
 
    const video::E_GPU_SHADING_LANGUAGE shadingLanguage =
        video::EGSL_CG; video::EGSL_DEFAULT;
 
    saturation_pass = gpu->addHighLevelShaderMaterialFromFiles(
        vsFileName4, "vs_main", video::EVST_VS_1_0,
        psFileName4, "ps_main", video::EPST_PS_1_0,
        mc_12, video::EMT_SOLID, 0, shadingLanguage);
    mc_12->drop();
}
Last edited by juanjpro on Sun Nov 30, 2014 4:37 pm, edited 1 time in total.
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Question about BlendOperation

Post by The_Glitch »

Man I'm going to be honest I'm not sure why your telling me OpenGL doesn't work with DirectX? I know this.
Nowhere in my code which is just Irrlicht's simple RTT example do I say use OpenGL drivers but then pass an HLSL shader.

Those are just Irrlicht's default layout in the tutorials to check If the driver used is OpenGL or DirectX. I stated that this is a very simple app to test the problem.

If what your suggesting was actually the problem then none of my shaders would not work, not just one of them.
juanjpro
Posts: 12
Joined: Mon Nov 24, 2014 12:54 pm

Re: Question about BlendOperation

Post by juanjpro »

The_Glitch wrote:Nowhere in my code which is just Irrlicht's simple RTT example do I say use OpenGL drivers but then pass an HLSL shader.
Sorry, my mistake.

After looking through this a bit better, I think you should be sending the sampler to the shader with the shader callback.
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: Question about BlendOperation

Post by The_Glitch »

Just wanted to update that I fixed the problem I edited the shader, everything I was doing in the main.cpp was actually fine. I hard coded the values and did not use any float variables.

I also suspect for this particular shader saturate semantics may have been causing a problem also.

Thanks to CuteAlien and juanjpro.
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: (Solved)Question about BlendOperation(SOLVED)

Post by The_Glitch »

Image


Don't mind the exposure haven't edited any values just testing the setup for now.
CuteAlien
Admin
Posts: 9634
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: (Solved)Question about BlendOperation(SOLVED)

Post by CuteAlien »

Cool, looking nice :-)
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: (Solved)Question about BlendOperation(SOLVED)

Post by The_Glitch »

This one is a more fine controlled result.
Image
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: (Solved)Question about BlendOperation(SOLVED)

Post by The_Glitch »

Image

Even better lol Halo 3. Now only If Irrlicht supported cubemaps :|
The_Glitch
Competition winner
Posts: 523
Joined: Tue Jan 15, 2013 6:36 pm

Re: (Solved)Question about BlendOperation(SOLVED)

Post by The_Glitch »

Image

Crazy ass bloom LOL
Post Reply