Simple trick, Lightmap

Previous topic - Next topic

mentalthink

Hi I don´t know if anyone comment this:

If you put a lightmap in the Bump map, you have the effect like a lightmap, vey, vey usefull...

The "trick" it´s use simple .jpg in the bum channel...

Whit this you can have a very good quality in the main texture, and use another whit less resolution, but modifing the light in the main texture, simulating a lot of light "whitout have it" in your Scene...

Slydog

Interesting, something I didn't know!

I'm looking for ways to improve my display in my game.
If its not too much of a problem, could you post a 'before' and 'after' screen shot to show what this does?

I don't know what 'put a lightmap in the Bump map' means.
The bump/normal map is a separate file from the texture, but how do you embed the light map into it?
What's the 'bum' channel?  I don't know what it is, but I don't like the smell of this!    :puke:  :P

Thanks.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

erico

A lightmap is a pre-rendered light only texture you export from your 3d package.
Then, you can map your object with that static light by loading this map into the bump map of your obj.

That way, you can benefit from occlusion and radio lights that would be a pain to code in real time.

It is quite good for ambient on indoors but it is essentially a static light, should you obj have strong shadows because it is close to a corner, it will still carry those shadows if you move it around.

Best would be to bake your light maps to either get the ambient light or an image projected one.
You should also be able to mix this ´baked light´ with GLB lights for greater results.
And also be able to fade the lightmap should you need no ambient on certain cases.

I´m not sure this clarifies, I would like to see the before-after too  ;/

You may also need to have some knowledge on the 3d package you are using to generate this.

mentalthink

HI Slydog, ok, leave to the weekeend and I try to make something... I´m not sure if the image has white and black in some part of the texture can be confused for Glbasic, and apply bump...

Basically it´s whats told Erico, Imagine a box, whit a texture, but you want add lighting to 2 faces, in a 3d soft, you export an image, this image only are the colors of the light, imagine green and blue... and you have the main texture... this it´s flat, in example a bricks wall, then whit the lighting texture, you can see the 2 faces whit color green and blue and mixing whit cubes... but you don´t loose quality in the main text, and you can works whit a lower lighting text... for better performance...

Slydog

#4
Thanks for the info guys.

No rush at all mentalthink, as the way I now understand it, this wont work for me.
My world / maze is generated at runtime, and this lighting technique only works for static worlds correct?

My maze is built from about 6 different (very simple) 3D models I designed in AC3D.
These 6 models are move and rotated multiple times per maze as needed. 
(ie. one model may be displayed 70 times at various locations and rotations)

I was hoping I could do something to make my world look more professional as it is looking kinda bland / amateurish.

Lighting was my next challenge to learn, such as spot lights, dynamic lights etc.
I was hoping this idea may help me but I don't think it applies.

Still wouldn't mind seeing some screen shots when you have them, curious just to see.
Thanks again.

[Edit] Last week I just added fake 'blob' style shadows beneath my power-ups. 
They don't look bad, but wont work for me for my main player object very well when moving up slopes where the shadow wont follow the contour.
I would love just to turn on a spotlight and have all objects generate their own shadows automatically!  Just a dream I suppose!  Using current technology / software this would be very slow I assume.
My current project (WIP) :: TwistedMaze <<  [Updated: 2015-11-25]

erico

I do believe a light map can help you out on the ´ambient´ light you want with your objects.
A similar thing, but made on code, is the shade you get from the cubes in minecraft, like an occlusion light.

So, you can have your objects with a pre determined ambient light, like mentalthink originally said, and use GLB lights over that, the ambient light can be controlled by fading the light map.

It can work on moving objects too, you will need some 3d pro-efficiency to get the perfect maps going in the first place.
If you want a clean or realistic style to your 3d, occlusion is a must.

Let´s suppose you are working with an ambient image, be it a sky box or whatever.
You can bake that ambient image light on all objects, that way they really look like they are there inside the world.

Understand I haven´t done much in 3d on GLB yet but a few tests.

mentalthink

Bad news!!! I try in PalmPre and don´t works, but I think can works in iPhone... I rebember the Bump mapping don´t works in Android and Palm Pre... dont´worry about this... the most effective manner to do this it´s mixing th 2 textures in Phothoshop or another paint tool... and well... only use a only one text...

@Slydog, about make lightmapping, you can use this... very easy, I use whit DarkBasic, and it´s free...

GILE´s...
http://www.frecle.net/index.php?show=giles.about

I don´t try whit GLbasic, but I will do some tryouts...


Hemlos

#7
This isnt true ambient occlusion, but it sure looks like it!
Im not using X_AMBIENT_LT here either.
Im not using textures either...but it works with them textured and/or bumpmapped.
Edit: All the vertex in the model are colored 0xffffff

Code (glbasic) Select
X_SPOT_LT 1, 0x448080, 0, 32768, 0, 0,  1,  0, 360
X_SPOT_LT 2, 0x112222, 0, -32768, 0, 0, -1,  0, 360
X_SPOT_LT 3, 0x112222, 0, 0, 32768, 0,  0,  1, 360
X_SPOT_LT 4, 0x112222, 0, 0, -32768, 0,  0, -1, 360
X_SPOT_LT 5, 0x112222, 32768,0, 0, 1, 0,  0, 360
X_SPOT_LT 6, 0x112222, -32768,0, 0, -1, 0,  0, 360


I like this one...its a keeper  8)

[attachment deleted by admin]
Bing ChatGpt is pretty smart :O

Hemlos

#8
Keep in mind, that is cuttoff 360


if you use it for a spotlight...you either reverse the polarity of the vector...

...or even easier to do.....inverse the sign of the cuttoff to -45 per say ;)

[attachment deleted by admin]
Bing ChatGpt is pretty smart :O

erico

Great!

An occlusion shader/render will sure spice up our 3d side! :good:

Hemlos

Does it look like what we were talking about in irc?
Just curious to know, because youre the light master, teach me master yoda  :nw:
Bing ChatGpt is pretty smart :O

erico

No master here. :nana:

It does look like what the occlusion should result.
Can you test it on a different model? A ball is not enough to check.

What about that ball distorted plasma stuff on the object analyzer demo?

Hemlos

Yeas sure please send me the object, ill give her a go, and you can tell me if it looks right.
Bing ChatGpt is pretty smart :O