Heightmap plus: phong model, alpha support

Forum for plugin, effect and behavior programmers. Please use the Help & Support forum for help using Construct.

Post » Sun Nov 29, 2009 1:03 am

I just wrote an updated Heightmap effect.

It shades the underying image using a heightmap-derived (grayscale, white is high) bumpmap. Alpha is taken into account, so transparent parts of the heightmap do nothing to the underlying image.

Also, specular spot size and intensity are done as in the phong model.

I see some strange glitchyness in my videocard (vertical flickering lines) so please test it out, it may be a bug in my video drivers.

Heightmap plus Beta 1
[url:158swbgv]http://octavoarte.cl/Heightmap%20plus.fx[/url:158swbgv]
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sun Nov 29, 2009 1:08 am

Yes. Many thx to you kind madster. Gonna try this out right now! :D
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Sun Nov 29, 2009 1:32 am

Im seeing some lines on the sprite as it gets closer to layout 0 x,y.

Is there a way to add color to the light?
Image Image
B
161
S
48
G
90
Posts: 7,350
Reputation: 66,755

Post » Sun Nov 29, 2009 2:13 am

the result doesn't look the same in the runtime as it does in the IDE.



Please make this work, I love heightmap.
B
25
S
3
G
6
Posts: 1,197
Reputation: 5,620

Post » Sun Nov 29, 2009 6:38 am

sadly i'm still a bit confused on what the coordinates mean in effects. Yeah they seem to be different in the IDE and in the runtime. 0 is top-left and 1 is bottom-right though.

What puzzles me is those flickering lines. I can't imagine why they come up.

EDIT: Just figured out the bug with the coordinates!! It's actually a Construct bug. The ide uses coordinates for the layout area where 0 is top-left and 1 is bottom-right... but that's the layout AREA, not just the layout! To test this out, hold mouse wheel and drag around.... and watch the objects lighting change.

I also noticed that it looks glitchy in the IDE unless I'm zoomed... so it's probably some kind of sampling alias.... I'll move the samples around, see what happens.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sun Nov 29, 2009 7:42 am

Fixed! (and reuploaded to the same location).

changed foreground sampling from half a screen-space texel in each direction to a whole screen-space texel. No idea why this was an issue, but works for me now.

Also: since there is no info available on texture size or object-space texels, the resulting angles depend on the size of the object =(

So, if you change your objects size, be sure to adjust the depth of the effect to compensate.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Sun Nov 29, 2009 8:13 am

Demo using an asteroids game I'm working on:

[url:2j22h9ql]http://octavoarte.cl/bumpy.exe[/url:2j22h9ql]

Light follows the mouse.

Bugfix: light direction was vertically inverted.
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Post » Wed Dec 02, 2009 9:34 pm

this is awesome mad
this revives my heightmapping in my game
which severely downgraded the look I hoping for when I first realized you can't do alpha

thanks for this
Spriter Dev
B
87
S
21
G
12
Posts: 3,240
Reputation: 16,461

Post » Thu Aug 11, 2011 8:46 pm

How do I download this?
B
83
S
21
G
15
Posts: 1,039
Reputation: 15,134

Post » Thu Aug 11, 2011 9:13 pm

Just copy the link out, if it opens as a text file do a Ctrl+S in your browser and save the FX file.
B
19
S
6
G
6
Posts: 1,101
Reputation: 5,646

Next

Return to Construct engineering

Who is online

Users browsing this forum: No registered users and 0 guests