Lights direction and intensity problem

View previous topic View next topic Go down

Lights direction and intensity problem

Post  bugman_2000 on Wed Jun 03, 2009 5:39 am

Hi,

I'm pretty new to Sio2 so apologies if I'm missing something obvious. I've been through the lights tutorial, and got it working fine, but now I'm working on a project of my own with lights and I'm having trouble.

Basically, there are two problems. The first problem is that the intensity of the lights is much lower in the iPhone than in Blender. I have to blast the lights to their full energy to get them to show up at all on the iPhone. There's no mist or anything, so I'm not sure what's going on.

The other problem is that the illumination is not coming from the correct direction. I have the lights placed to the right and left of an object. I've used the method of drawing a colored point at the location of the lights to visually make sure that the lights are where I want them, and this appears to tell me that the lights themselves are in the right place. However, the object is being lit from some light source directly below it. There's no light coming from the right and left.

I hope this was clear enough. I can attach some images too if it would help. Anybody know what could be causing such a problem?

T

bugman_2000

Posts : 14
Join date : 2009-04-30

View user profile

Back to top Go down

Re: Lights direction and intensity problem

Post  sio2interactive on Wed Jun 03, 2009 5:42 am

You need to export the normals dude... check the video tutorial08... I explain that specifically...

Cheers,

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Lights direction and intensity problem

Post  bugman_2000 on Wed Jun 03, 2009 5:56 am

Hey, thanks!

Indeed, you did explain it. It just slipped my mind. Things are looking much better now!

T

bugman_2000

Posts : 14
Join date : 2009-04-30

View user profile

Back to top Go down

Re: Lights direction and intensity problem

Post  sio2interactive on Wed Jun 03, 2009 5:59 am

Hehehe for sure Wink

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Lights direction and intensity problem

Post  _-MADMAN-_ on Wed Jun 03, 2009 7:46 am

I realized one thing few days ago - there is a "problem" with sun light type. In fact with direction - It is inverted. Before export my scenes I have to rotate my sun in to opposite direction if I want same results in SIO2 as in Blender. Never use spots so have no idea if there is same issue. Anyway lamps are ok Wink Just for information, maybe someone already post about it - if Yes excuse and delete post.

_-MADMAN-_

Posts : 52
Join date : 2009-04-23

View user profile

Back to top Go down

Re: Lights direction and intensity problem

Post  sio2interactive on Wed Jun 03, 2009 4:17 pm

What exactly is inverted and on which axis...

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Lights direction and intensity problem

Post  _-MADMAN-_ on Thu Jun 04, 2009 3:12 am

I have no idea how looks blender internal data of lights and how it is translated to sio, but It looks like Blender sun direction is:
FROM light point TO light distance end

And sio take it as:
FROM light distance end TO light point

So light direction is "inverted". In fact, from explorations, it has nothing to do with rotation and location of the light. I'm not sure about rotation, couse blender light direction is strictly binded to rotation and there is no way to change dir without rot. Anyway, all this issues are tested with sunlight type.



Hope it's clear and helpful.

Regards,
Mad

_-MADMAN-_

Posts : 52
Join date : 2009-04-23

View user profile

Back to top Go down

Re: Lights direction and intensity problem

Post  sio2interactive on Thu Jun 04, 2009 3:30 am

Are you sure cuz checking from the exporter that direction vector seems to be correctly exported:

Code:


            #===============================
            # DIRECTION
            #===============================
            tar = ( Blender.Mathutils.Vector( 0.0, 0.0, -1.0 ) * obj.matrixWorld )
            loc = Blender.Mathutils.Vector( obj.loc[0], obj.loc[1], obj.loc[2] )
            
            dir = tar - loc

            buffer = "\td( %s %s %s )\n" % ( optimize_float( dir.x ),
                                                              optimize_float( dir.y ),
                                                              optimize_float( dir.z ) )
            f.write( buffer )


_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Lights direction and intensity problem

Post  _-MADMAN-_ on Thu Jun 04, 2009 3:41 am

As I said - I do not now how it works inside. I working in blender about eight years and there is one thing I have learned - Blender is always different Laughing One thing is clear - all levels with sunlight after export are with sun from the ground in sio. So I simple rotate sun and In blender I have light from the ground... but in sio is ok Wink

_-MADMAN-_

Posts : 52
Join date : 2009-04-23

View user profile

Back to top Go down

Re: Lights direction and intensity problem

Post  sio2interactive on Thu Jun 04, 2009 4:13 pm

i think your problem is coming from somewhere else... cuz the direction vector calculation is ok... are you sure that your normals are pointing the good direction?

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Lights direction and intensity problem

Post  _-MADMAN-_ on Fri Jun 05, 2009 2:07 am

Yep, I'm working in texture not glsl mode, so I see one side faces... anyway nvector draw shows that they are ok. Hmmm - in Your machine everything is ok with sun export? Maybe it's problem with my blender or something (I'm using tests builds with new features, but had same issue with 2.48a).

_-MADMAN-_

Posts : 52
Join date : 2009-04-23

View user profile

Back to top Go down

Re: Lights direction and intensity problem

Post  sio2interactive on Fri Jun 05, 2009 6:20 pm

Yep, I'm working in texture not glsl mode,

>> What does that mean? Wink


Hmmm - in Your machine everything is ok with sun export?

>> The same calculation is used for sun, spot, camera etc... if it work for the camera it will work with the sun...

_________________
SIO2 Interactive
Free Open Source 3D Game Engine for iPhone and iPod Touch
http://sio2interactive.com
avatar
sio2interactive

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

View user profile http://sio2interactive.com

Back to top Go down

Re: Lights direction and intensity problem

Post  _-MADMAN-_ on Sat Jun 06, 2009 1:57 am

In Game panel You can change viewport and BGE display mode - in glsl You can see shaders and faces are double sided, so without "draw normals" You can't see witch side will be drawn in sio2. Anyway - textured mode draw same as sio - one sided faces, pervertex lightning, alpha and vertex light intensity (no spec).

No idea why direction is inverted. I will try it with spots and report.

_-MADMAN-_

Posts : 52
Join date : 2009-04-23

View user profile

Back to top Go down

Re: Lights direction and intensity problem

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

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