Explain DX Lighting, Dynamic Shadows and Lightmap

Blitz3D Forums/Blitz3D Beginners Area/Explain DX Lighting, Dynamic Shadows and Lightmap

hoyoyo80(Posted 2015) [#1]
Hi forumers:)

I am currently nuclearbasic purchaser. Not user yet since i dont have time to learn it yet. Hihihi.

But suddenly friends said Blitz3D is also a good alternative and now free so i found that Blitz3D together with FastExt is quite a good engine.

But that not my question. Im read through the tutorial and some info about dx light, dynamic light&shadows and lightmapping
So what is the difference between them and when to use it. Since to my understanding, lightmap is ready drawn shadows and light but funny if later it is use with real light.

Thanks


videz(Posted 2015) [#2]
Wow ok. You purchased a full solution and you're now into Blitz3D?? I think that would be going backwards.. and a negative review for them

Honestly from what I know, you're good with that Nuclear Basic stuff, you bought and already invested on it. I like B3D though don't get me wrong here.

BUT if you're into Blitz products now, you can also try Blitzmax or the other opensource version of it.. BMX NG or something. It's free and it's here.. somewhere.. in pieces.. you just need to build it.. ask Bruce ;)

In the end try it as well, it's all free. The FastExt has a 5min limit though then a popup to buy the full version. it's rather cheap around $25 for the whole FastLib shebang!

there I've said it. BTW welcome to this site, i guess..


hoyoyo80(Posted 2015) [#3]
Thanks. Not saying nuclear basic is bad product. first thing, my friends have this fastext, mean reduce graphical effect programming( iguess). Beside im frustrated nuclear studio( 3d editor) is canceled(delayed?). So its look like b3d and fastext can make a quick prototype.

Ok. either b3d or nuclearbasic i still need to understand the concept of real time light and lightmap. Lightmapped level can still receive light? but i think i will look funny. Can someone help me with the concept.


videz(Posted 2015) [#4]
yes you can definitely make a quick prototype w/ b3d and fastext. just look at them demos.

lightmapped levels is highly supported in B3D, just find some recent discussions here.

It can receive light but there's a lack of shaders in fastext so you cannot manipulate this, only by default blending which ruins the original texture.

You can also try Ploppy's HardWired/Hybrid B3D library which supports DX9/DX11 and shaders but is still in experimental stage.


RemiD(Posted 2015) [#5]
From what i understand :

Lighting :

per vertex lighting (precalculated or realtime) : the lighting is calculated according to the normal of each vertex or of each triangle (your choice) with your custom formula or with the one of directx 7 lights. You can use vertexcolor to color each vertex.
If the surface has many triangles, the shades of the lighting will look nice and progressive, but if the surface has only a few triangles, the shades of the lighting will look weird in some cases. (for omnilights, directlights, spotlights)
see : http://en.wikipedia.org/wiki/Gouraud_shading

per texel lighting (=lightmapping, precalculated) : the lighting is calculated according to the normal of each triangle and according to the position of the texel on the triangle, to do this kind of lighting you need a tool or a routine to autounweld (so that each triangle has its own vertices), then autotexelsfill (determine how many texels will be used in the triangle depending on the triangle pwidth pheight in 2D), then autouvmap (define the uv coords of each vertex on the lightmap texture) the triangles and then you need to calculate the lighting of each texel with your custom formula or with a premade formula (as you want) (for omnilights, directlights, spotlights)
see : http://en.wikipedia.org/wiki/Lightmap

per pixel lighting (realtime, impossible with blitz3d because it requires shaders) : (for omnilights, directlights, spotlights)

ambient lighting : this is the default color added to each surface (which is not fullbright) on all triangles of the surface (even those who are not lighted by any light)



Shadows :

per vertex shadows (precalculated) : if the surface has small enough triangles (doable on indoor/small scenes) you can precalculate the shadows of static obstacles. Each vertex which has been lighted with vertex lighting is simply shadowed depending on the obstacles between the light and the vertex. (for omnilights, directlights, spotlights)
see : http://en.wikipedia.org/wiki/Gouraud_shading

per texel shadows (=lightmapping, precalculated) : if the texel size is small enough (in each unwelded, texelsfilled, uvmapped, triangle), you can precalculate the shadows of static obstacles. Each texel of each triangle which has been lighted with texel lighting is simply shadowed depending on the obstacles between the light and the texel. (for omnilights, directlights, spotlights)
see : http://en.wikipedia.org/wiki/Lightmap

stencil shadows (devil shadow system) (realtime) : creates shadow volumes and then depending on if the pixel is inside a shadow volume or outside a shadow volume, it is either lighted or shadowed. (for omnilights, directlights, spotlights)
see : http://en.wikipedia.org/wiki/Shadow_volume

shadowmapping ? (fastext / swift shadow system) (realtime) : "takes a snapshot from the light's point of view and use it to map a shadow texture over the objects who receive it" (only for directlights, spotlights)
see : http://en.wikipedia.org/wiki/Shadow_mapping

per pixel shadows (realtime, impossible with blitz3d because it requires shaders) : (for omnilights, directlights, spotlights)


Matty(Posted 2015) [#6]
Per pixel shadows are possible with stock standard b3d ...see sswifts shadow engine .... they are just hugely inefficient. ...


RemiD(Posted 2015) [#7]
Per pixel lighting (on the pixel of the image of the render) is not the same than per texel lighting (on the texel of the texture)...


hoyoyo80(Posted 2015) [#8]
Thanks for input forumers.

Actually i read on how to lightmap from this forum. It stated that lightmapped level need to be fullbright and it will not react to light anymore. So how about effect such as torchlight ..or more advance like blended specular using fast ext.

Thanks


RemiD(Posted 2015) [#9]

So how about effect such as torchlight


You can probably use this :
http://www.blitzbasic.com/codearcs/codearcs.php?code=1000

or this :
http://www.blitzbasic.com/Community/posts.php?topic=72399 (post #16)


hoyoyo80(Posted 2015) [#10]
Wowowow...code archives. Although blitz3d is quite dated but the community and archive is more mature than other engine. Ok thanks


RemiD(Posted 2015) [#11]
for a nice spotlight effect you can also use a dx7 spotlight (vertex lighting) on subdivided floors/walls/ceilings/columns


hoyoyo80(Posted 2015) [#12]
Hmm, a while since i post this. How do games use light and shadow system actually? Do game use lightmap or dynamic lighting?(before this and current gen). I manage to bake my shadow and load it on blitz3d but it of course the mesh dont react to the moving object when going to the area with shadow? Do i need to use dynamic shadow as in FastExt?(But i notice some levels look good if the lightmap is baked)

ADDED: or do we can mix lightmap for static thing and make all moving object as shadow receiver?

Thanks


videz(Posted 2015) [#13]
Same problem as I and others have with mixing static and dynamic shadows. dead end, fastext cannot handle this cause its only a hack.

If you know shader coding, then Ploppy's Hybrid library is a more plausible solution because it supports DX9 shaders.

there you go..


hoyoyo80(Posted 2015) [#14]
Hmm. i have no idea on shader programming. That going on with Nuclearbasic. Shader remain unused if u dont know how to program it. Hahaha


videz(Posted 2015) [#15]
yep anyone who has a thing with mixing shadows should be going for UE3/4, Unity or GoDot. it has dynamic and lightmap solution already built-in.

It all comes down to shaders, just like what I've been saying..


Matty(Posted 2015) [#16]
They're not the only solutions....depending on what you want to do....if it is a simple enough game then coding natively for your target platform is always an option too.


hoyoyo80(Posted 2015) [#17]
Im aware that programming can achieve a lot of things. but i have very limited knowledge and always look for built-in thing:)


RemiD(Posted 2015) [#18]
To blend the shadows of fastext/swift/dss with the shadows of a lightmap, maybe there is a way in Blitz3d :
Instead of blending the shadows fastext/swift/dss over the shadows of a lightmap with a mesh/texture blend, capture the render of the shadows of fastext/swift/dss on an image (with the non shadows areas colored in 0,0,0), then capture the whole scene with the lightmap, then draw the image with the shadows of fastext/swift/dss over the render of the whole scene, and the shadows of the lightmap should not be visible below the shadows of fastext/swift/dss.
But there will not be a progressive shading from one to another...


hoyoyo80(Posted 2015) [#19]
I also have trouble applying shadow texture to "animmesh".
If not i can get all the child as caster since exporting combined mesh have no access to child.