[Desperate] How to recreate realistic light?

  ... discussions regarding GLES2 ShaderPrograms (VertexShaders and FragmentShaders).

Re: [Desperate] How to recreate realistic light?

Postby IFL » Fri Feb 01, 2013 8:53 am

Do you understand GLSL? I can outline how to do it, but knowing GLSL is vital because I guarantee you don't want an exact replica of my effects. You also linked to several different types of shaders (some of which are multi-pass) - which of the links are the closest to what you are wanting?

IFL
User avatar
IFL
 
Posts: 177
Joined: Fri Mar 04, 2011 6:28 am

Re: [Desperate] How to recreate realistic light?

Postby klanpaia » Fri Feb 01, 2013 2:25 pm

Hello I understand a little

But my main problem is to connect the effect in AndEngine
klanpaia
 
Posts: 12
Joined: Thu Oct 27, 2011 3:43 am

Re: [Desperate] How to recreate realistic light?

Postby klanpaia » Sat Feb 02, 2013 7:13 pm

IFL could you please post a simple example like this: http://www.badlogicgames.com/wordpress/?p=471
implementation of shader. Thank U :)
klanpaia
 
Posts: 12
Joined: Thu Oct 27, 2011 3:43 am

Re: [Desperate] How to recreate realistic light?

Postby IFL » Fri Feb 08, 2013 10:03 pm

klanpaia wrote:IFL could you please post a simple example like this: http://www.badlogicgames.com/wordpress/?p=471
implementation of shader. Thank U :)

klanpaia wrote:Hello I understand a little

But my main problem is to connect the effect in AndEngine

Would I be correct in guessing that you are running into problems with binding uniforms/attributes to the shader? It's not the easiest thing to figure out, but it's easy once you get it. I don't have much time right now so I can't convert that code to work with AndEngine yet, but after looking at it I can say that it won't be as easy in AndEngine because the vertex positions are automatically transformed by the entity-hierarchy. If you did it the way Mario does, you'll lose the setPosition/scale/etc methods that make AndEngine easy to use. For setting uniforms (a vec4 array in this case), it's something like:

Code: Select all
int uniformLocation = this.getUniformLocation("uniform_name");
in the link() method followed by:

Code: Select all
GLES20.glUniform4fv(uniformLocation, float4Array.length/4, float4Array, 0);
in the bind() method.

The array must be flattened to a single dimension (float[16] for a vec4 array with a size of 4 instead of float[4][4]) to be sent to the hardware. I think it would help for you to take a look at the PositionColorTextureCoordinatesShaderProgram class in the org.andengine.opengl.shader package to see how it works. Let me know if this helps and/or if you need further direction. I'll try to find some time in the next couple of days to convert that code to work with AndEngine - the PositionColorShaderProgram class is almost identical to it if you want to take a look at it as well.

IFL
User avatar
IFL
 
Posts: 177
Joined: Fri Mar 04, 2011 6:28 am

Re: [Desperate] How to recreate realistic light?

Postby klanpaia » Mon Feb 11, 2013 3:41 pm

Thank you very much

Would I be correct in guessing that you are running into problems with binding uniforms/attributes to the shader?

Exactly :(

I'll be studying the class PositionColorTextureCoordinatesShaderProgram
What can explain
I'll be very thankful

These are some tutorials on the effect I want, but it is for libgdx
http://www.youtube.com/watch?v=O1zW2XETuXA

http://www.box2d.org/forum/viewtopic.ph ... 6&start=10

http://www.emanueleferonato.com/2007/09 ... al-part-1/
klanpaia
 
Posts: 12
Joined: Thu Oct 27, 2011 3:43 am

Re: [Desperate] How to recreate realistic light?

Postby wirher » Tue May 07, 2013 12:39 pm

Oh IFL if you could port this to AndEngine it would be awesome!
wirher
 
Posts: 86
Joined: Wed Nov 21, 2012 11:28 am

Re: [Desperate] How to recreate realistic light?

Postby wirher » Mon May 13, 2013 6:28 pm

I think I'll bump this one - something like that creates great opportunity to make horror scenes and deep ocean scenes. I wish I knew OGL..
wirher
 
Posts: 86
Joined: Wed Nov 21, 2012 11:28 am


Return to ShaderPrograms

Who is online

Users browsing this forum: No registered users and 2 guests