FORUM CLOSED, PLEASE REGISTER AT FORUM.SIO2INTERACTIVE.COM
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Dot3 Normal Bump Mapping + Per Pixel Lighting

+8
_-MADMAN-_
autology
uprise78
finthamoussu
Francescu
goldfrapp0x0309
fleg
sio2interactive
12 posters

Go down

dot3 - Dot3 Normal Bump Mapping + Per Pixel Lighting Empty Dot3 Normal Bump Mapping + Per Pixel Lighting

Post  sio2interactive Thu Apr 23, 2009 10:18 pm

Take a look at the link above:

http://www.vimeo.com/4309315

Basically Im switching between 4 mode of lighting the first one being the default OpenGL one and 3 other mode controlled by combiners... You can also invert the side of the bumps and control the lighting conditions via combiners callbacks, I think its pretty flexible Wink

A tutorial will be added in 1.3.6 to show you how it work basically its 2 SIO2 call so it should be easy to integrate within your project(s).

Code:


      if( !init_tbn )
      { sio2ObjectSetTBN( _SIO2object, inverted ); }
      
      
      sio2ObjectDot3Lighting( _SIO2object,
                        sio2->_SIO2camera,
                        _SIO2lamp );

Now I know what you guys are asking yourself: "That's all great but what about performance?"

I test 80 objects like this:

object/Cube ( 72:372:81% ) ( 213:372:43% )

So basically its a total of: 10k or triangles and it run at 30 ~ 42 fps on my iPod Touch 2nd Gen, all the lighting is done in the main thread so there's plenty enough space for optimization there such as calculating the lighting in another thread etc...


Last edited by sio2interactive on Fri Apr 24, 2009 5:37 am; edited 4 times in total
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

dot3 - Dot3 Normal Bump Mapping + Per Pixel Lighting Empty Re: Dot3 Normal Bump Mapping + Per Pixel Lighting

Post  fleg Thu Apr 23, 2009 10:26 pm

Dude. DUDE. AWESOME.

fleg

Posts : 4
Join date : 2009-04-20

Back to top Go down

dot3 - Dot3 Normal Bump Mapping + Per Pixel Lighting Empty Was beddin'

Post  goldfrapp0x0309 Thu Apr 23, 2009 11:19 pm

Dragged myself out of bed n.... WOW!!! Hope it performs quick and fast too...
goldfrapp0x0309
goldfrapp0x0309

Posts : 43
Join date : 2009-02-28

Back to top Go down

dot3 - Dot3 Normal Bump Mapping + Per Pixel Lighting Empty Re: Dot3 Normal Bump Mapping + Per Pixel Lighting

Post  sio2interactive Thu Apr 23, 2009 11:36 pm

The ligthing calculation need to be executed in per frame, but it can easily be calculated in a separate thread... I'll create a tutorial showing how to do it...

Im also doing a quick hack and avoid make sure that the vector are exactly perpendicular so like that its like a lot less calculation and with work fine with convex shapes so, but it is not mathematically fully accurate... If I had access to shaders it would be but... Wink
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

dot3 - Dot3 Normal Bump Mapping + Per Pixel Lighting Empty Re: Dot3 Normal Bump Mapping + Per Pixel Lighting

Post  Francescu Fri Apr 24, 2009 12:07 am

Very very nice! Shocked

Francescu

Posts : 136
Join date : 2009-03-18

Back to top Go down

dot3 - Dot3 Normal Bump Mapping + Per Pixel Lighting Empty Re: Dot3 Normal Bump Mapping + Per Pixel Lighting

Post  finthamoussu Fri Apr 24, 2009 7:59 am

Can't see the video Crying or Very sad : "Sorry, you do not have permission to watch this private video."
finthamoussu
finthamoussu

Posts : 10
Join date : 2009-03-30
Age : 41
Location : Montevideo, Uruguay

Back to top Go down

dot3 - Dot3 Normal Bump Mapping + Per Pixel Lighting Empty Re: Dot3 Normal Bump Mapping + Per Pixel Lighting

Post  uprise78 Fri Apr 24, 2009 9:13 am

I get the "private video" message too. How can we view the video?

uprise78

Posts : 228
Join date : 2008-10-31

Back to top Go down

dot3 - Dot3 Normal Bump Mapping + Per Pixel Lighting Empty Re: Dot3 Normal Bump Mapping + Per Pixel Lighting

Post  autology Fri Apr 24, 2009 11:11 am

try again - video is working for me.

As for the demo.... I can't wait to play. This engine is going to be leaps and bounds ahead of where it was when I took a break from coding.

autology

Posts : 22
Join date : 2008-12-29

Back to top Go down

dot3 - Dot3 Normal Bump Mapping + Per Pixel Lighting Empty Re: Dot3 Normal Bump Mapping + Per Pixel Lighting

Post  _-MADMAN-_ Fri Apr 24, 2009 2:04 pm

Just brilliant! One of the best iPhone cg effect I have ever seen - players will get crazy!

What with materials? Any plans for integration that feature with blender? Texture binding and set - same way as with lm in actual sio2 sdk. I'm talking about export ofcourse Smile

Regards!

_-MADMAN-_

Posts : 52
Join date : 2009-04-23

Back to top Go down

dot3 - Dot3 Normal Bump Mapping + Per Pixel Lighting Empty Re: Dot3 Normal Bump Mapping + Per Pixel Lighting

Post  sio2interactive Fri Apr 24, 2009 5:23 pm

Have you guys been able to watch the video?
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

dot3 - Dot3 Normal Bump Mapping + Per Pixel Lighting Empty Re: Dot3 Normal Bump Mapping + Per Pixel Lighting

Post  uprise78 Fri Apr 24, 2009 5:33 pm

works now and it looks great!

uprise78

Posts : 228
Join date : 2008-10-31

Back to top Go down

dot3 - Dot3 Normal Bump Mapping + Per Pixel Lighting Empty Re: Dot3 Normal Bump Mapping + Per Pixel Lighting

Post  Neo Sat Apr 25, 2009 6:32 pm

Man this looks awesome! cant wait to see the tutorial

Neo

Posts : 1
Join date : 2009-04-02

Back to top Go down

dot3 - Dot3 Normal Bump Mapping + Per Pixel Lighting Empty sio2ObjectDot3Lighting source?

Post  sgreenwalt Thu Jun 18, 2009 9:55 pm

Is it possible to get the source for sio2ObjectDot3Lighting and sio2ObjectSetTBN before release of 1.3.6? Like maybe . . . right now?

sgreenwalt

Posts : 18
Join date : 2009-04-24
Location : Layton, Utah

Back to top Go down

dot3 - Dot3 Normal Bump Mapping + Per Pixel Lighting Empty Re: Dot3 Normal Bump Mapping + Per Pixel Lighting

Post  sio2interactive Fri Jun 19, 2009 12:47 am

Actually, you can get it up and running by simply doing this...

1. Simply use tutorial08 and arrange the texture of the ground so the first texture channel is the normal map and the second is the diffuse, make sure that you set the 2 UV channel properly (or simply duplicate them).

2. In the code simply add the following block:

Code:


      glActiveTexture( GL_TEXTURE0 );
      glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
      glTexEnvf(GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_DOT3_RGB );

      glTexEnvf(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE);
      glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR);

      glTexEnvf(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PRIMARY_COLOR );
      glTexEnvf(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR);

      
      glActiveTexture( GL_TEXTURE1 );
      
      glTexEnvf( GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE );
      glTexEnvf( GL_TEXTURE_ENV, GL_COMBINE_RGB, GL_MODULATE );
      
      glTexEnvf( GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE );
      glTexEnvf( GL_TEXTURE_ENV, GL_SRC1_RGB, GL_PREVIOUS );

      glTexEnvf( GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR );
      glTexEnvf( GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR );   


Here's the normal map for the stone wall:

http://sio2.dreamhosters.com/stone_wall_normal_map.jpg
sio2interactive
sio2interactive

Posts : 1526
Join date : 2008-08-26
Age : 44
Location : Shanghai

http://sio2interactive.com

Back to top Go down

dot3 - Dot3 Normal Bump Mapping + Per Pixel Lighting Empty Re: Dot3 Normal Bump Mapping + Per Pixel Lighting

Post  MistaED Sat Jun 20, 2009 10:17 pm

Very nice demo indeed! The video works fine but I think the normal map looks inverted?

I'm curious though, would animated models (ones with md2 morph targets or the hybrid armature system, things with moving vertices) need to have bitangent data assigned to its vertices so that dot3 would work on deformed models and if so, would this be possible at a decent framerate? Also I'm not too sure if this was asked before but was sphere mapping at all possible with the iphone or was it a limitation that you needed the cpu to do the mapping? I'm thinking it would be really cool to mix that with the dot3 and make animated water effects Smile

MistaED

Posts : 4
Join date : 2008-11-08

Back to top Go down

dot3 - Dot3 Normal Bump Mapping + Per Pixel Lighting Empty Re: Dot3 Normal Bump Mapping + Per Pixel Lighting

Post  yarri Thu Aug 20, 2009 4:00 am

Hi, has anyone been able to get this to work with 1.4? Including the OpenGL code into the Tutorial08 templateRender() function with the normal map added doesn't seem to work...
dot3 - Dot3 Normal Bump Mapping + Per Pixel Lighting Pictur10

Any thoughts?

Thanks,
--yarri

yarri

Posts : 81
Join date : 2009-04-10

Back to top Go down

dot3 - Dot3 Normal Bump Mapping + Per Pixel Lighting Empty Re: Dot3 Normal Bump Mapping + Per Pixel Lighting

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum