Lightmapping partial success, need final advice!

Blitz3D Forums/Blitz3D Beginners Area/Lightmapping partial success, need final advice!

RustyKristi(Posted 2014) [#1]
So I finally made some progress in blending lightmaps and texture shadows, somehow.. :)

My only problem is the original global illumination quality is discarded when using Multiply mode (default = Mode 2 or multipl2x = Mode 5) on the lightmap.

Any tips to retain the global illumination lighting with multiply?

Here is a sample that I have done using Gile[s] and FastExt Shadows Trial



You can see the comparison with the untouched mesh vs the modified mesh using textureblend.

Appreciate any help, thanks!


RemiD(Posted 2014) [#2]
I am not sure if your problem is produced by the blendmode, it may be produced by a too dark ambientlight in giles and too bright ambientlight in blitz3d/fastext


RustyKristi(Posted 2014) [#3]
Hi RemiD,

Thank you for the quick response. Apparently, both are the same model and texture. I have setup a trigger to switch between blendmode on the lower mesh and it changed to a darker tone when I switch and trigger between the blend modes, and the above is multiplyx2.

Question, do I need to use the same ambient light color in giles and blitz3d?

I would just like to have a darker shadow in my lightmaps (so I'm using ambient light in giles) while maintaining a bright static gi lighting like the original mesh above it..


RemiD(Posted 2014) [#4]
The shadowed areas and thus the shadows, are of the color of the ambient light (remember the ambient light is everywhere even in shadowed areas, this is why some meshes can be visible even without a light).
If you use one color for the shadowed areas/never changing shadows of the static casters and another color for the changing shadows of the turning moving casters, it will appear weird.

Just my opinion, you do what you want.


RustyKristi(Posted 2014) [#5]
Okay, I already set the ambient color the same for both, nothing changed.

What I am still having problems with is still the blend mode with blitz changing my lightmap texture and removing the gi maps by blending it..

I do not see any results when I only manipulate the shadow texture and leave the lightmapped model untouched. when I apply both multiply on both it ruins the lighting on the model :((

Do you have any success with this type of setup? How?


RemiD(Posted 2014) [#6]
If you have access to the mesh of the shadow, maybe you can color the texels of the shadow to the color of the ambient light (or slightly darker) and then decrease the alpha of the mesh of the shadow until the shadow blends well with the shadowed areas of the lightmap ?

another idea would be to keep a copy of the lightmap with the shadows of the static casters, and create a copy of the lightmap, and use copyrect to add the shadows of the turning moving casters to the copy of the lightmap, and paint your mesh with the copy of the lightmap on your mesh instead of the original lightmap. Not sure if this will be fast enough... Also you will need to have a lightmap with enough texels per unit (at least 1 texel per 0.1unit) or it will look bad...


RustyKristi(Posted 2014) [#7]
Thanks again for these info RemiD. I wish you could provide some basic demo if you have tried it already at your end. As for the texels, I have no idea where to start and how to go about those.

I believe there's a solution for this and I have yet to see a game that fully utilizes this either as indie or just a demo in Blitz3d.

It does work with multiply blend but it's obvious with the multiply option it also ruins the GI data that is also on the lightmap texture. or am I just doing it incorrectly?

P.S: Already contacted FastLib and Frecle (giles) and still have not received any response from them :/


Kryzon(Posted 2014) [#8]
You cannot do this in a straightforward way with only the fixed functionality that Blitz3D and the FastLib give you.

This is done with pixel shaders, where you have complete control over how a pixel from the dynamic shadow texture and the static lightmap are combined. In this case Blitz3D is holding you back.

Perhaps you can port your project to that "Hardwired" engine, which seems to support shaders. You'll have to inform yourself with other users how to use shaders with that.
http://www.blitzbasic.com/logs/userlog.php?user=13255&log=1897

- - - - -

Here are some examples of this being done with other engines:


Taken from: http://docs.unity3d.com/Manual/LightmappingInDepth.html


Taken from: https://answers.unrealengine.com/questions/48053/unreal-engine-udk-shadow-blending-method.html


RustyKristi(Posted 2014) [#9]
Thanks a lot for this info Kryzon :) I'm just not aware that Blitz3d, particularly 3rd party libraries like FastLib did not support this. I don't mind porting to the HardWired version, in fact I really like the project!

So now my questions are:

1) How hard is it to replicate the above effects that seems to be the standard now to optimize scenes? I know even UDK and Unity has these features for performance reasons and a very significant tool.

2) Is hardwired compatible with existing libs like Fastext?

3) Do I need to use DX9 now and the new commands or can I stick with the default Blitz3d DX7 functions since I will be just using shaders?


Kryzon(Posted 2014) [#10]
1) It's as hard as learning shader programming. Once you know how to write complex HLSL shaders you'll understand how to implement a variety of effects, and mixing shadowmaps with lightmaps is such a use.
Here someone suggests a formula for it:
http://irrlicht.sourceforge.net/forum/viewtopic.php?f=4&t=45070#p259025

2) No. The FastLibs poke and peek the Blitz3D memory for integration. Hardwired was programmed from scratch, so the architecture is absolutely different.

3) I don't know much about Hardwired, you'd better ask someone more experient. As far as I know there is an effort to use the same commands etc.


RustyKristi(Posted 2014) [#11]
Thank you Kryzon, this is very informative. Now I know and have a clear understanding on where I will be moving forward with my Blitz project.

BTW, are you a shader guy yourself? or could you recommend someone of caliber who can take on this task? I would be interested in offering contract work to achieve this feature and at the same time make it open source to blitz community down the line.

Kudos and thanks again.


Kryzon(Posted 2014) [#12]
Hello.
You can reach me through my e-mail. You can find it in my profile page by clicking on my nickname.


RustyKristi(Posted 2014) [#13]
Thanks Kryzon. just sent you an email! :)