Page 3 of 3
Re: Question about BlendOperation
Posted: Sat Nov 29, 2014 4:22 pm
by CuteAlien
You set the shadingLanguage to video::EGSL_CG, but then pass a hlsl shader.
Re: Question about BlendOperation
Posted: Sun Nov 30, 2014 8:21 am
by The_Glitch
Hmm Interesting never saw that, I changed it to
Sadly It changed nothing though.
Re: Question about BlendOperation
Posted: Sun Nov 30, 2014 3:21 pm
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();
}
Re: Question about BlendOperation
Posted: Sun Nov 30, 2014 3:52 pm
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.
Re: Question about BlendOperation
Posted: Sun Nov 30, 2014 4:29 pm
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.
Re: Question about BlendOperation
Posted: Mon Dec 01, 2014 9:06 am
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.
Re: (Solved)Question about BlendOperation(SOLVED)
Posted: Mon Dec 01, 2014 10:47 am
by The_Glitch
Don't mind the exposure haven't edited any values just testing the setup for now.
Re: (Solved)Question about BlendOperation(SOLVED)
Posted: Mon Dec 01, 2014 1:19 pm
by CuteAlien
Cool, looking nice :-)
Re: (Solved)Question about BlendOperation(SOLVED)
Posted: Mon Dec 01, 2014 4:54 pm
by The_Glitch
This one is a more fine controlled result.
Re: (Solved)Question about BlendOperation(SOLVED)
Posted: Fri Dec 12, 2014 10:17 pm
by The_Glitch
Even better lol Halo 3. Now only If Irrlicht supported cubemaps
Re: (Solved)Question about BlendOperation(SOLVED)
Posted: Sat Dec 13, 2014 5:19 pm
by The_Glitch
Crazy ass bloom LOL