preethams sky impementation + HDR


(theShadow) #21

Having this hardcoded in blender would indeed be amazing.

martinh, mokazon, you guys are awesome.


(Neox38) #22

So if you add a cube to the scene without HDR how would you light it so its not black? Great work by the way!


(LordOdin) #23

how long did it take to unwrap the terrain i make big ones like that and i bet it takes over an hour


(Neox38) #24

Any ideas on getting the HDR version to work with ATI cards?


(Neox38) #25

I am wondering. What parameters did you use for the screen shots martinsh? On my AMD card it looks like this


(blendenzo) #26

It looks that way on Blender 2.62 and later for some reason. I also tried it in recent SVN build from blender.org and a Swiss Cheese build from Graphicall, and had the same problem.

Edit: Oops… this is not the problem. Martins said earlier in the thread it was because a python script was not running, and as others have stated, the problem occurs in 2.60 and 2.61 as well.


(Neox38) #27

I wonder which build martinsh uses maybe the Blender Eye Candy build?


(3d solar system builder) #28

Mine shows up black also.


(GraphiX) #29

Whenever I see a thread started by martinsh, I know I’ll be thrilled. I still have yet to be proven wrong.


(martin.hedin) #30

I made a little tweaked version where the HDR is not white, I intend to use this one for exteriors, and light interior independently with the BGE Candy textured arealights build (realtime archviz) that you can find here: http://devlog-martinsh.blogspot.com/2012/11/bge-candy-area-lights.html

2.64 version Blend (normal build, candy not necessary): http://www.pasteall.org/blend/17579


(martin.hedin) #31

And here is the file that you should use with the Candy Arealights build: http://www.pasteall.org/blend/17584
With one set of monkeys using light from the sky, the leftmost using arealights:


All objects except ground using light from arealights:

Attachments



(martin.hedin) #32

It bothered my how nice the lighting from the arealights is, and how rough the lighting is defined in the ground.py. Also if you would like to illuminate objects with this set of python code, you do not get the lights from other sources.

Then it occurred to me that the sun defined in sky.py is based on a light placed in space. So what I did was to crank up that lightsource and also changing it to an arealight, that with the candy build shades objects really nicely.

The result is a lighting set-up, where the sky is defined by sky.py, and a terrain is defined by ground.py. But objects are using the normal BGE, but they are being lit by the arealight defining the sun position. Voila you can use all kinds of lights and also the sun from its correct position.

The only problem is that we need a python script that can change the output of the arealight defining the sun so that it is not lighting up the geometry at night, output depending on position.

And at the moment the sun is a square, but since you now can texture arealights you can have any shape you like!

If you want to add more lights, remember to duplicate the sun arealight and delete the older one. The python scripts are using gl_LightSource[0].position for the sun, which will be the last light created.

Blend: http://www.pasteall.org/blend/17586

Use the Candy build, or the build found here: http://devlog-martinsh.blogspot.com.es/2012/11/bge-candy-area-lights.html

Attachments



(nbac) #33

this area light implemantation of martins is pretty awesome.
since he did not publish any code, i used the original implematation of Arkano22 to reproduce the effect for my engine.

i am getting a result but it is definitv incorrect. i can see the rectangle/lightsource but its position and direction are off.
i use gl light input

but what is that?

vec3 right = normalize(vec3(gl_ModelViewMatrix*gl_LightSource[i].ambient));     vec3 pnormal = normalize(gl_LightSource[i].spotDirection);     vec3 up = normalize(cross(right,pnormal));

modelview * ambient color? does that make any sense?

the rest seems to be pretty clear.
martinsh can you give any hint. how you solved it for blender and how you optimized arkons code even more?

any help apreciated


(MarvTheM) #34

How to set the sun’s position (or rather which light source to follow)? It seems to be in relation with any random parented light source… In this case it follows my player’s shadow spot light which is quite funny. The lower I get the darker it becomes.


(martin.hedin) #35

The code specifies “gl_LightSource[0].position”.

It seems to be the last created light. Try to copy the sun SHIFT+D, and delete the old one.


(MarvTheM) #36

It worked. Thanks a lot! Seems like I didn’t read your post above…


(cyrfer) #37

Thank you for the files! Your implementation is helping me tremendously. I tested with Blender 2.73. In BGE, the screen is completely white out of the box. However, if I start throwing scale factors (0.01) around, I can get the sky and ground to look good.

gl_FragColor.rgb = scale_factor * tonemap(Lin+L0);

Do you know why that scale factor must be added?

I was struggling to find good references for the Preetham method. Your code saved my butt!