lightmaping buildings _ _ _

Paulov

26-10-2006 15:42:20

well, as I comented in previous posts I´ve started lightmaping my buildings.

After generating the lightmaps I was geting as result in the ofusion viewport a mesh with just the lightmap. THat was because the textures where black.

more info about black textures:
http://www.ogre3d.org/phpBB2addons/viewtopic.php?t=1354

First lightmaped building. [no textures are visible]


next to this I´ve solved the black textures problem so I´ve been able to run textured buildings with lightmaps.


This last building has been Atached prior to lightmaping.
After lightmaping the material has been converted to ogre material.
After converting, the specular and ambient colors had been moved from black to white. [At least Ambient, specular, depending on the material you´re looking for]

And now you´re done.

Particularly in this testing, the estructural pillars appear without textures but 2 of them, something strange, even more if you look at the render window where it appear with all of them textured.

But does not matter, is just a test and has gone well since in the ofusion viewport the building is rendering with textures and lightmaped.

Now its obvious that it needs to be tested more seriously, so lets get our well known test tower.



Steps:
0 place a skylight
0 set "advanced lighting" in the "render scene dialog" to "Light Tracer", this will give you very fast rendering.
1 attach the mesh
2 render to texture (lightmap)
3 convert materials to ogre materials
4check results

if results are satisfactory you`re done

if not, change the ligth properties, like intensity, orientation.... and redo the litghtmap....
Ouch!! no target slot for the lightmap!!! dont worry about this, even the -self ilumination slot- does not exist anymore, the new generated lightmap will be readed as it overwrites the original one that this routed from the oFusion material. good news eh?! :wink:

Some coments:
I´ve done lightmaps with an intensity of 3, but it should vary depending on the lighting your´re looking for.

The pillars are looking too dark (black) from their inner face, thats not very realistic, I´ve tried to make them brighter by givin an Emisive to the faccade behind them, but has not work. If someone has any idea on how to solve this.... [dont want to add more lights, and light only the pillars, its quite nasty, looking something easyer...]

dark inner face of pillars
facade with emisive-->

killer test with, 80.000 polygons runint smooth.



I´ve saved the lightmaps in .tga &.dds and both of them ar too heavy in my opinion, even if they where 256x256. I´ll try with .dxt in a near future.

Also found unsatirfying that when when 2 long perpendicular planes met, a bright line is generated in the lightmap] creating and indesired effect. Anyone know how to solve this? [ appart from photoshop].
This is very clearly seen in this image, where the floor and the green doors met:


IDENTIFIED THE NEED OF THE FOLLOWING TOOLS/UTILITIES.
A box showing the framerare and the polycount. [this is already done no?, how can it be activated?]
The memory used by the textures (IMPORTANT), this is a must to tune the objets to the max.

Pablo_

Lioric

26-10-2006 16:59:49

Is there any reason of the lightmap usage your are doing?

If you use lightmaps, then why you need other dynamic lights? when the light is baked in a texture, you should disable "Lighting" in the material, and the object will use the vertex colors, make them full white and the light will come from the baked texture as supposed

When the light is disabled in the material, it will improve the performance in your scenes, as the objects wont be included in the light process, but it will be rendered with the vertex colors, and the proper light/shadows will be from the light texture

It seems you are baking a complete map (diffuse, light, shadows), you should bake a light/shadow texture only, and use it in your object as a multitexture (in another "modulated" Texture unit)

In this case you will have the diffuse texture (the color image) of any size or resolution you need in the a texture unit of your object pass material, and the baked light texture in another texture unit, this texture can be a low resolution image (even 64 or 128 will do it for your object), the resolution will be improved by the modulate effect and the filtering

In this method you can increase the intensity of the light by using a modulate multiplier blend mode as "modulateX2" or "modulateX4" modes

Paulov

28-10-2006 00:39:36

hi-there-

==first I answers questions, then I coment some things===

If you use lightmaps, then why you need other dynamic lights?
--> whell, I didnt explains the things correctly, I was speaking about adding more light to solve the problem of the dark inner face of the pillars wich I´ve finally solved by another method.

When the light is disabled in the material, it will improve the performance in your scenes(...)

nice, but as I´ve multimaterials, setting "lighting"box off can be quite "just a bit" boring, would it be the same if I set the "cast shadow"parameter of in the standard max objet properties ?. [you know if I kan do in just a move.. better..]

It seems you are baking a complete map (diffuse, light, shadows),

nope, I have the ligthmap done as you recomend. I´ve texted the modulatex2 &x4 but i´ve not obtained satisfying results. :( dont worry this issue is solved by now, so one more thing about the materials I know :roll:
______________________________________________________________

I´ve solved the dark pillars problem by modifying the color/intensity of the extra ambient, as seen in the image:


in this image you can see the difference that causes in the general shadowing the modification of this parameter:


Here you can see a problem that has appeared when modifying this parameter, the problems appear in the base of the pillars where some of the shadows appear in a very strange way:


This lightmaps have been done with Ray Tracer.
I´ve given an overlook to the Radiosity options and it is like a universe, so I´m staying with Ray Tracer for a while and go slowly with Radiosity since it looks more flexible, but for now its enough.

Pablo_

Paulov

29-10-2006 17:56:56

Hi, once finished with single building lightmaping, I´ve started lightmaping a set of buildings and a plaza, and here are the results ordered cronologically

first lightmaps>> its tood dark>> may be suitable for an abandoned city, but not wat I´m looking for



next lightmaps look fine!, thats the ilumination that should appear if it was a cloudy day.



next lightmaps with direct sunlight shadows, looks fine eh:



this ones are the same as previous but with ground texture aplied:


some random tests with coloured lights


now: I would have liked to fihish the scene with textures+lightmaps, but I´ve been unable to run the script that allows multiple emssive/amibent modification, and since this scene has a number of materials could have taken mi too much time.

Would be fine if someone could help me with this script [max script]
my skill in programin is = (0) :P




for i in selection do (
mtl = i.material
if mtl != undefined do (
if classOf mtl == Ogre_Material do (
mtl[2][1].emissive = [1, 1, 1]
)
)
)


I understand this script says.
In this selection, whatever the material is, if it is ogre material, set its Emissive to white.
___________________________________________________________

-I´ve converted to ogre both single & multisubobjet materials.


now some questions:

-why you think didnt work to me?

-has de material name any influence? I understand that no...

-I understand that in the last line you give the emmisives "position" by saying that it is in the second "box"[2] and that is the "first" [1] value "named" emmisive, is this correct?
I ask you this because I would preffer to modify the Ambient since modifying the Emissive make this objets not to be affected by any "realtime" light in the scene (I dont know If I´ll have any of these, but could be). To modify the ambient would be something like this?

mtl[1][1].ambient = [1, 1, 1]

Pablo_ _ _

Paulov

31-10-2006 10:15:36

well

Finally I´ve set the ligthting off (one by one) because I couldnt wait more to check the results, here some screens.



the results are great, but there are things that need tuning.

-now dont have much time so at night I´ll edit the post and coment some issues.-

Pablo_

Lioric

31-10-2006 15:32:31

nice screenshots :) excellent job

The syntax for accessing a technique, pass or textureunit of a material in scripts is:


mtl[technique slot number + 1][pass slot number][texture unit slot number]


where "mtl" is the variable that contains the material object

you access a material technique using its slot number + 1, i.e. to access the first technique of the material is mtl[2]

to access a pass of a technique, use its slot number, i.e. to access the first pass of the first technique of the material is mtl[2][1]

to see the available properties of a material object you can use the "showProperties" method, i.e.


showProperties mtl[2][1]


this will produce the list of the avaialble properties of the first pass of the first technique (the list will include the names you can use and the type of the value they need)

You can read or write (get or set its value) the property you need, i.e. "mtl[2][1].ambient" if you need the "Ambient" prop, or "mtl[2][1].lighting" if you need the "Lighting" prop

yuriythebest

01-11-2006 07:33:02

this is a very nice thread, I hope to benefit from it in my next project- in my current asteroids game I simply baked the skylight into the small spaceship