Ambient Light?
Blitz3D Forums/Blitz3D Beginners Area/Ambient Light?
| ||
As noted here My spaceship looks too dark. This is due to having a low AmbientLight. The only light is sourced by the sun and this is set as a type 1 lightsource which according to the docs has infinite range and position, so this cannot be made 'stronger' (aside from using brighter color values. If I try to increase the AmbientLight, the 'dark-side' of planets etc. become too bright. Effectively, they should be close to black (just look at a crescent moon!) What workarounds are there? I cannot use a separate Light for the spaceships as there will be far too many of these and I believe these HW lights are limited to about 8(?) |
| ||
Multipass rendering maybe. Render the planets etc first with the existing light setup. Do not clear the Zbuffer. Then render your ships with a different light setup. |
| ||
Nice idea there. Bit reluctant to attempt it as that's gonna entail a helluva lot of Hiding pivots and parent entities. Not to mention the slowdown, but thanks. I have been wondering if there's a simpler way to effectively gauge the side of the planet that's AWAY from the sun and perhaps add a shadow texture to half of it? |
| ||
Yes, that would work well, particularly if you can figure out how to do it without altering the planet mesh uv's. I think it should be possible to do it just using position and rotate texture functions but I am not sure exactly how to transform a normalised direction vector into texture space like this. |
| ||
What about simply using vertex lighting on the sphere - set the color of the vertices to rgb 0,0,0 on the 'dark side' of the planet? |
| ||
Easier for sure, but not as fast. Just use the dot product of the vertex normal and direction vector to determine if the vertex is facing the sun or not. You may want to grade the delineation a bit based on that to avoid a rather jagged appearance. |
| ||
Mmm, but aren't spaceships supposed to look really dark in space? What you have here is realism. I assume you are using HUD markers to highlight them? Just put lots of flashing lights on some of them - many spaceships will have these, unless they are pirate vessels etc. |
| ||
Yeah puki, when I get round to the HUD and targetting systems etc, the game will play a lot more via systems than the visuals, and target crosshairs and reticules will highlight the ships etc. Not to mention the decals and lights still to be added. I wanted this realism, but the feedback on the graphics link made me wonder at which point I should detract from the realism in favour of "what the people want" |
| ||
Okay, I'm prepared to give the Vertex-Lighting thing a try, anyone got any links to tutorials or anything that could help me with this? I'm using standard primitive spheres if that's any help? |
| ||
You could give the lightmesh command a try. It might fit the bill and I think will be faster than anything you could code yourself. Just remember it is cumulative, so if you want to apply it every frame you will need two operations, one to clear the mesh colors. So use Lightmesh planet,-255,-255,-255 to clear the vertex colors then use Tformpoint 0,0,0,sun,planet to get the suns position in respect to the planet, then Lightmesh planet, red,green,blue,range,tformedx(), tformedy(),tformedz(). Just play with the range a bit. From memory it is not quite the same as the lightrange equivalent. Other than that just make sure you entityfx planet,1+2 |
| ||
Heh! Totally forgot about that command! I think it can come in EXTREMELY useful. Thanks a million, DJW! ------------------ Just did some tests! It solves all my lighting problems heh! |
| ||
You should do like the movies and use three or four lights at different angles and intensities. Mix up the colour a bit too. Ambient Light is flat shading, losing gemoetry detail where there is no lightsource. Anything else is just being complicated! Plus if you use baked on lighting, it will look wrong when you turn away from the lightsource. |
| ||
And if you simply use cubemaps? :-) Gives full detail as with real lights but without using the costly hardware lights. |
| ||
Depending on how your models' normals are set up cube mapping may not work as wanted. A Blitz cube will show flat shading where other modelled objects will likely show mirror-like reflections of the cube map. GPU hardware has been able to manage vertex lighting effectively for yonks. Unless you've got very detailed models or lots of objects on screen it shouldn't be a bottleneck, whilst being more compatible with older cards that don't support cube mapping or handle more than 2 textures. And if you're not aiming for cards that old, four lights on a few space ships won't tax any more capable card. Perhaps I'm imagining the wrong scene here, but in something like Elite/Frontier with say a half dozen ships on screen, I'd go with 3 or 4 light sources, and a couple of textures per ship for colour deco's and maybe some cubemapped highlights. The lights are much easier to work with than cube maps if you want to change the lighting. |
| ||
The problem with the 3-4 is that you can only have 7 hardware lights active at the same time. (number 8 or better 0 is ambient light). CubeMap with the command setcubemapmode can be used for various things and especially works on lowpoly ships. Hardware lights need vertices to have a light effect. |
| ||
I'm not toosure about CubeMaps, I believe they may cause problems with implementation (and I really dont wanna re-structure the entire game so far heh) Also, aren't they gonna be slow? The ships are kept low/mid-poly, but there's potentially going to be a lot of them, and the space stations are gonna have some pretty high polycounts. Anyway, I'm getting on fine with LightMesh, so thanks again :) |
| ||
Have you tried these commands SetGamma UpdateGamma I've never used them but it may be worth playing with. |