Feature Request: B3D Text Index Control [Images!!]

Blitz3D Forums/Blitz3D Programming/Feature Request: B3D Text Index Control [Images!!]

Sledge(Posted 2004) [#1]
I know this isn't the best time for a feature request but I think it could be pretty useful so I'll mention it. It basically follows on from my recent appeal (http://www.blitzbasic.com/Community/posts.php?topic=40154) in which I mentioned that I was having to set up a particular effect manually. The effect in question was a fairly neat vertex light that obliterates the lightmap upon the surface it affects. Here is an illustration of it in use...

Here is the scene with the vertex light swithed off, meaning it is completely dark in the lightmapped corridor:


Switch the light on and...

...the lightmap is negated. This is done by loading the lightmap into index zero and setting its blend mode to Add, then loading the regular model texture into index one (default blend mode). The drawback is that Blitz (apparently) only lets you retexture the model with a single texture - which might be fine for a simple test (in the screenshots the walls, ceiling, floor and reflection are all separate models, which is why there's more than one texture) but is not representative of normal use at all.

What I'd like, therefore, is the ablity to switch the indexes that a b3d's textures use somehow. As far as I can see (and please correct me if I've missed something) it's the only way we're going to get the best out of that ADD blend mode.

I have, of couse, tried a few different ways of getting a similar result. If one just loads the model and leaves the textures as-is (default indexes, default blend modes), we get the following...
Vertex light off:


And switched on...

What we get in this case is the result of the lightmapping illuminated, which basically means that if a texture has already been darkened then the vertex light will not be able to restore it. In other words, it shows you a now-clearly-visible shadow! (The reflection is not lightmapped, by the way, hence it shows up fine.)

The obvious thing to try was to at least set the lightmap's blend mode to ADD, that way we can apply it to a model with multiple textures. Unfortunately, simply reloading the lightmap and setting it to ADD without putting it below the regular textures leads to this...


Now we lose the regular textures completely unless we switch on the vertex light, resulting in...


As you can see, the textures begin to fade where the light range runs out. "Ack!" all round on that one, then.

Anyway, I've spent a few days running through texture blend modes and whatnot and, unless I'm missing something, it seems like the ability to manipulate the texture indexes of a loaded object would be pretty handy. I'm sure those more familiar with the B3D file format could probably hack the changes, but I'm thinking that a BASIC way to do this (ie via a Blitz command) would be worthwhile. Am I crazy?


Dreamora(Posted 2004) [#2]
What is the exact problem?
That textures fade out where the model disappears is normal and the way it has to be ( a higher level of ambient light might help here ).
The only other thing is to make the whole mesh not responding to light with setting it to fullbright.

For lightmap: Try Blendmode 5

Multiply ( mode 2 ) can only darken
Add ( mode 3 ) can only brighten up
MultiplyX2 ( mode 5 ) can both, with 128,128,128 as neutral


Sledge(Posted 2004) [#3]

What is the exact problem?



The vertex light does not illuminate light/shadow-mapped textures unless you make sure the lightmap occupies index zero with the regular textures above. You can't stick yer lightmap on index zero without ruining a model that uses more than one regular texture. That's the problem - at default, lights don't negate shadow maps, which looks horribly wrong.


For lightmap: Try Blendmode 5


Did that, but with the same lightmap -- couldn't find the docs describing Mode 5 (cheers!) so it's possible that might help if I tweak it a bit. I fear it won't provide a fix though, as it's not what's being done but the order it's being done in that is problematic.


Dreamora(Posted 2004) [#4]
Never tested if this might help ... but did you try the VertexColor EntityFX? ( might be that this idea is totally useless ... I never really used VertexLightning because HardwareLights were"too slow" )