Shader flipping everything!
-
- Posts: 260
- Joined: Thu Apr 17, 2008 1:38 pm
- Location: Brasopolis - Brazil
Shader flipping everything!
Hello guys,
I'm facing a strange problem here.
I'm trying to do a car painter, like Need for Speed Carbon. Worked well and I'm happy with it, but I have a problem and have no idea how to solve.
I have one Scene Manager where the car texture is made. I can mix bitmaps and achieve the desired paniting without any problems (left image).
But, when I apply my shader, various images are flipped upside down. (right image).
Testing, I discovered that if I load directly an Image and not use the RTT one, this problem doesn't happen, even using my shader.
I noticed too that this happens only with images applyed AFTER the shader call.
How can I solve this?
Thanks
I'm facing a strange problem here.
I'm trying to do a car painter, like Need for Speed Carbon. Worked well and I'm happy with it, but I have a problem and have no idea how to solve.
I have one Scene Manager where the car texture is made. I can mix bitmaps and achieve the desired paniting without any problems (left image).
But, when I apply my shader, various images are flipped upside down. (right image).
Testing, I discovered that if I load directly an Image and not use the RTT one, this problem doesn't happen, even using my shader.
I noticed too that this happens only with images applyed AFTER the shader call.
How can I solve this?
Thanks
Professional Software Developer and Amateur Game Designer
Re: Shader flipping everything!
This is probably a problem with OpenGL driver. If so, do two RTTs, so it would flip back to normal. At least that's what I was told when I had this problem with RTTs.
Working on game: Marrbles (Currently stopped).
-
- Posts: 260
- Joined: Thu Apr 17, 2008 1:38 pm
- Location: Brasopolis - Brazil
Re: Shader flipping everything!
Hi Serengor,
How can I do two RTT's?
by calling
two times?
No difference here.
Thanks for the fast reply
How can I do two RTT's?
by calling
Code: Select all
driver->setRenderTarget(pintura, true, true, SColor(255, 255, 255, 255));
No difference here.
Thanks for the fast reply
Professional Software Developer and Amateur Game Designer
-
- Posts: 260
- Joined: Thu Apr 17, 2008 1:38 pm
- Location: Brasopolis - Brazil
Re: Shader flipping everything!
Keep trying here, but no success yet...
The another RTT should be another quad with another camera pointing to it?
To the experts, why this are bugging the others images that have nothing with the shader or RTT?
Keep working!
The another RTT should be another quad with another camera pointing to it?
To the experts, why this are bugging the others images that have nothing with the shader or RTT?
Keep working!
Professional Software Developer and Amateur Game Designer
Re: Shader flipping everything!
Using irr+gl+rtt = some bug somewhere mixing up the origin. The recommended workaround = set2dmaterial(get2dmaterial) (not exact syntax obviously, not at my usual comp).
Re: Shader flipping everything!
Yes, I meant it like that. It worked perfectly fine for me.Auradrummer wrote: The another RTT should be another quad with another camera pointing to it?
Also maybe switching UV coords might do the job?
Working on game: Marrbles (Currently stopped).
Re: Shader flipping everything!
In a vertex shader You can reverse an Y component of your quad UV.
Library helping with network requests, tasks management, logger etc in desktop and mobile apps: https://github.com/GrupaPracuj/hermes
Re: Shader flipping everything!
or reverse your texcoord
i faced the same issue with my game of life project
i faced the same issue with my game of life project
-
- Competition winner
- Posts: 80
- Joined: Tue Jun 29, 2010 10:06 pm
- Location: Valencia, Spain
Re: Shader flipping everything!
With version "1.7.2" always happens exactly the same.
With earlier versions work well.
With earlier versions work well.
Follow me on twitter: @themrcerebro
Re: Shader flipping everything!
Or move to DirectX if that option is feasible.
"There is nothing truly useless, it always serves as a bad example". Arthur A. Schmitt
Re: Shader flipping everything!
Hi,
I've got the same pb with svn version (not the latest though). I can't move to directX and don't want to create another quad/cam. Rendering twice on the same quad doesn't change anything. I am a beginner with shader and as such, I don't succeed in reverting my texcoord.
I tend to do: gl_TexCoord[0] = gl_MultiTexCoord0 - vec4(0.,1.,0., 0.); in my vert shader but doesn't work.
I've got the same pb with svn version (not the latest though). I can't move to directX and don't want to create another quad/cam. Rendering twice on the same quad doesn't change anything. I am a beginner with shader and as such, I don't succeed in reverting my texcoord.
I tend to do: gl_TexCoord[0] = gl_MultiTexCoord0 - vec4(0.,1.,0., 0.); in my vert shader but doesn't work.
Using trunk with mingw/gcc 4.6, Windows 7 64 bits driver opengl
-
- Admin
- Posts: 14143
- Joined: Wed Apr 19, 2006 9:20 pm
- Location: Oldenburg(Oldb), Germany
- Contact:
Re: Shader flipping everything!
Could please someone set up a simple test case where I can reproduce this?
Re: Shader flipping everything!
generaly texcoord can be reversed by simply adding
ouput.texcoord = 1.0-texcoord
in vertex shader but then again that depend on your specific vertex shader
ouput.texcoord = 1.0-texcoord
in vertex shader but then again that depend on your specific vertex shader
Re: Shader flipping everything!
@Hybrid > You can download my first attempt at shaders derived from example 13:
http://downloads.tuxfamily.org/bluecosm ... re_poc.zip
It should be simple enough for you to have it running quickly.
@granyte> i work with glsl (4.1) and gl_TexCoord[0] = vec4( 1,1,1,1) - gl_MultiTexCoord0 ; revert according to x and y, and I get exactly the same result for gl_TexCoord[0] = vec4( 0,1,1,1) - gl_MultiTexCoord0.
http://downloads.tuxfamily.org/bluecosm ... re_poc.zip
It should be simple enough for you to have it running quickly.
@granyte> i work with glsl (4.1) and gl_TexCoord[0] = vec4( 1,1,1,1) - gl_MultiTexCoord0 ; revert according to x and y, and I get exactly the same result for gl_TexCoord[0] = vec4( 0,1,1,1) - gl_MultiTexCoord0.
Using trunk with mingw/gcc 4.6, Windows 7 64 bits driver opengl
Re: Shader flipping everything!
I have the same problem, but the change ($i_DeviceType) of OpenGl to DirectX solve the problem.
Obs: I use AutoIt with IrrLicht.
Obs: I use AutoIt with IrrLicht.