How to have an uniform sunlight ?

Problems building or running the engine, queries about how to use features etc.
Post Reply
dragonblood
Halfling
Posts: 68
Joined: Sat Apr 25, 2015 4:01 pm
x 6

How to have an uniform sunlight ?

Post by dragonblood »

Hi,

I have a problem with my sunlight. I created a directionnal light with direction of Sun. Well but my character is lighted as one edge (the edge in front of the sun) and he is totally black when i turn camera around him. I'd like to have a light more uniform as realife. But How ? How many light I've to create for exemple ?

++
scrawl
OGRE Expert User
OGRE Expert User
Posts: 1119
Joined: Sat Jan 01, 2011 7:57 pm
x 216

Re: How to have an uniform sunlight ?

Post by scrawl »

Use an ambient light, SceneManager::setAmbientLight.
dragonblood
Halfling
Posts: 68
Joined: Sat Apr 25, 2015 4:01 pm
x 6

Re: How to have an uniform sunlight ?

Post by dragonblood »

ok but with an ambiant light my terrain and my character is lighted but there is no detail, for exemple my character is totally pink we can't see details as muscles, textures, etc...
dragonblood
Halfling
Posts: 68
Joined: Sat Apr 25, 2015 4:01 pm
x 6

Re: How to have an uniform sunlight ?

Post by dragonblood »

look

Image
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Re: How to have an uniform sunlight ?

Post by syedhs »

Try to boost your emissive light (self-lighting)
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
User avatar
Kojack
OGRE Moderator
OGRE Moderator
Posts: 7157
Joined: Sun Jan 25, 2004 7:35 am
Location: Brisbane, Australia
x 534

Re: How to have an uniform sunlight ?

Post by Kojack »

Valve uses a technique called half lambert. (You need a shader for it)
You do the standard lambert lighting algorithm (normal dot dirToLight), but then multiply the result by 0.5, add 0.5 and square it. This turns a 1 to -1 range into a 1 to 0 range. The light will wrap around to the back.
It's fake, but is a cheap way to simulate global lighting.
https://developer.valvesoftware.com/wiki/Half_Lambert
dragonblood
Halfling
Posts: 68
Joined: Sat Apr 25, 2015 4:01 pm
x 6

Re: How to have an uniform sunlight ?

Post by dragonblood »

syedhs wrote:Try to boost your emissive light (self-lighting)
I try with emissive light but it is very ugly.

with emissive 0.3 0.3 0.3

Image
scrawl
OGRE Expert User
OGRE Expert User
Posts: 1119
Joined: Sat Jan 01, 2011 7:57 pm
x 216

Re: How to have an uniform sunlight ?

Post by scrawl »

Your character doesn't appear to have textures.

If you want it to look less flat, you'll either need to texture it or use more sophisticated shading techniques, e.g. an ambient occlusion compositor.
dragonblood
Halfling
Posts: 68
Joined: Sat Apr 25, 2015 4:01 pm
x 6

Re: How to have an uniform sunlight ?

Post by dragonblood »

I'd tried compositor SSAO but I don't know how to make it work.

I try

Ogre::CompositorManager::getSingleton().addCompositor(mCameraBack->mCamera->getViewport(), "SSAO/GBuffer");
Ogre::CompositorManager::getSingleton().setCompositorEnabled(mCameraBack->mCamera->getViewport(), "SSAO/GBuffer", true);

but my screen is totally black
Last edited by dragonblood on Mon Aug 17, 2015 11:45 pm, edited 2 times in total.
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: How to have an uniform sunlight ?

Post by xrgo »

If I remember correclty for those ssao effects you need to add various compositors, GBuffer, Crytek and Modulate (I think)
dragonblood
Halfling
Posts: 68
Joined: Sat Apr 25, 2015 4:01 pm
x 6

Re: How to have an uniform sunlight ?

Post by dragonblood »

When I add GBuffer my screen become black.
User avatar
syedhs
Silver Sponsor
Silver Sponsor
Posts: 2703
Joined: Mon Aug 29, 2005 3:24 pm
Location: Kuala Lumpur, Malaysia
x 51

Re: How to have an uniform sunlight ?

Post by syedhs »

I think you just need a texture for the character.. the last image looks ok but it doesn't have texture.
A willow deeply scarred, somebody's broken heart
And a washed-out dream
They follow the pattern of the wind, ya' see
Cause they got no place to be
That's why I'm starting with me
dragonblood
Halfling
Posts: 68
Joined: Sat Apr 25, 2015 4:01 pm
x 6

Re: How to have an uniform sunlight ?

Post by dragonblood »

syedhs wrote:I think you just need a texture for the character.. the last image looks ok but it doesn't have texture.
ok but how can I Texture it ? I'm not a graphist and this is a high poly model (7000 poly). I use Maya. How can i create texture easily ?
dragonblood
Halfling
Posts: 68
Joined: Sat Apr 25, 2015 4:01 pm
x 6

Re: How to have an uniform sunlight ?

Post by dragonblood »

OK i used Simple SSSAO from here http://www.ogre3d.org/tikiwiki/tiki-ind ... imple+SSAO

It works !! But my mesh is too dark and when i add Ambiant or emissive there is no effect on my mesh.
Post Reply