4 Attachment(s)
3D lighting shader (2D Normal Mapping) w. 3 lights
Normal Mapping pixel shader
http://click.andersriggelsen.dk/foru...tingEffect.jpg
With this pixel shader you can apply 3D-like colored lighting to your sprites that you can update in real-time (up to 3 completely separate lights)
To make the effect, you only need two versions of your image.- Your sprite
- A normal map made from your sprite that covers your sprite
To make a normal map of your sprite, you first need to make a "heightmap" of your sprite. It is a greyscale image where the lightness of the pixel determines how "close" to the viewer that point is. In my example the nose of "Alyx Vance" is the closest to the viwer (us) and is therefore very light.
I then use a tool like either Photoshop using this plugin from Nvidia to convert the image from a heightmap to a normal map.
If you use Gimp you can use this plugin.
I'm quite sure there is some plugin for Paint.NET as well.
http://click.andersriggelsen.dk/foru...htToNormal.jpg
What do you think? :)
Re: 3D lighting shader (2D Normal Mapping) w. 3 lights
This is cool! :D
stephen1980
Re: 3D lighting shader (2D Normal Mapping) w. 3 lights
Will check it out when I get home. Looks great though.
Re: 3D lighting shader (2D Normal Mapping) w. 3 lights
This is pretty rad. Will work awesomely on static things, but it would be a huge pain to generate normal maps for all the frames of anything animated. I may try implementing this in my new project.
Re: 3D lighting shader (2D Normal Mapping) w. 3 lights
I did this last year: http://www.clickteam.com/epicenter/ubbthreads.php?ubb=showflat&Number=108916#Post1089 16
Well, except it was one light, not 3, and it was a directional light, not what looks like point lights.
Good work :)
Re: 3D lighting shader (2D Normal Mapping) w. 3 lights
Very nice effect!
But when i start the example, i get this:
http://img11.imageshack.us/img11/245...example.th.jpg
The picture is scaled somehow (in frame editor and at runtime).
Re: 3D lighting shader (2D Normal Mapping) w. 3 lights
Oh god, you killed her!!!
Re: 3D lighting shader (2D Normal Mapping) w. 3 lights
Quote:
Originally Posted by bigredron
Oh god, you killed her!!!
LOL!
stephen1980
Re: 3D lighting shader (2D Normal Mapping) w. 3 lights
Didn't know you already made one Dynasoft :)
Quinto:
You are the second person to experience this. Yves was a bit puzzled about it too. Maybe he can get a better idea what is going on if you post your graphic card details. Thanks :)
About rotation:
I will add a property that allows you to rotate the effect. If you use the MMF2 inbuilt angles it will also rotate the background behind the object.
Re: 3D lighting shader (2D Normal Mapping) w. 3 lights
Quote:
Originally Posted by bigredron
Oh god, you killed her!!!
Yeah, pixel saw massacre!! http://www.smilies-and-more.de/pics/...iolent/019.gif
;)
@Andos
ATI Radeon X1900 XT 256 MB
Catalyst version 08.1
OpenGL version 6.14.10.7275
Direct3D version 6.14.10.0555