Bump/Parallax Mapping -anyone have a working GLSL example?

All topics about ZGameEditor goes here.

Moderator: Moderators

User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Bump/Parallax Mapping -anyone have a working GLSL example?

Post by jph_wacheski »

I have been hacking around all morning with a bunch of net tutorials and sample code,. however no Bump/Parallax working correctly yet,. does anyone have a .zgeproj file to show?

Here is some stuff I have found;

http://www.ozone3d.net/tutorials/bump_mapping_p4.php
http://www.dhpoware.com/demos/glslParal ... pping.html

this one is just sorta interesting; http://cowboyprogramming.com/2007/01/05 ... let-holes/

and a little app. may be of interest I have not yet tryed it ; http://crazybump.com/

and attached is a bit of my experiments,. for the coming dungon crawler,. anyone get the film ref.?
Attachments
dungon_walls_006.zip
.exe good 'n cheesy!
(43.9 KiB) Downloaded 676 times
iterationGAMES.com
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Hehe, love the graphics! Can't pick the reference though. And I've never done any bump mapping myself so can't help you there.
User avatar
Kjell
Posts: 1883
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hmm,

Never did bump / parallax myself either ( not really into the Doom 3 thing ), but the oZone3D tutorial works fine for me.

K
Attachments
Bump.zip
(201.1 KiB) Downloaded 650 times
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

ha, your cool,. that don't help me though. I never played doom 3. .,

The problem I am having working with shader,s is figuring out what values are coming from elseware in ZGE,. and what they are refered to when in a shader? The textures and other material properties, the light, camera position,. etc. guess I will have to go through making little tests,. once I figure these out, I will write up a list of them and post it,. . to help others attempting to work with this.

film ref; I was quoting the Supreme Being at the begining of Time Bandits.
Attachments
supremebeing.jpg
supremebeing.jpg (3.71 KiB) Viewed 16635 times
iterationGAMES.com
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Well if we ask Kjell nicely enough perhaps he will share the zgeproj-file of his example :)

The only custom variables (except any user-defined variables in Shader.UniformVariables) that ZGE passes to the shaders are "tex1", "tex2", "tex3" that corresponds to the textures of the selected material.

"uniform sampler2D tex1;"

A list of predefined opengl-variables that can be read inside a shader can be found in the GLSL-manual.
User avatar
Kjell
Posts: 1883
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hey guys,

Since I just copy-pasted the shader directly from oZone3D ( renaming colorMap -> tex1 + normalMap -> tex2 ), I didn't actually save the .zgeproj of that example. But I assume something had gone wrong for jph when trying that?

I can re-create / re-copy-paste the example if you really want though :P

K
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

Guys do we still need the light component for the bitmap now that we got the bump mapping? ^^
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
Kjell
Posts: 1883
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

...

In case the answer will be yes ( to my own question, not Francesco's ) .. here's the source :wink:

K
Attachments
Bump.zgeproj
(558.97 KiB) Downloaded 674 times
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

Yeah, I got it working after Ville's post,. I had been getting results without using tex1-3 for other shader hacking so was unsure as to why. But thanks for postin' it Kj!

kattle- hummm,. the light could be usefull for drawing textures still,. however some way to generate those normal maps would be even MORE usefull,. with a bumpmap shader like this ;)
iterationGAMES.com
User avatar
VilleK
Site Admin
Posts: 2277
Joined: Mon Jan 15, 2007 4:50 pm
Location: Stockholm, Sweden
Contact:

Post by VilleK »

Great example Kjell, very illustrative with the moving light, thanks for posting.
User avatar
Kjell
Posts: 1883
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

?

Generate Normal-Maps? A normal map is just a texture like any other ( but with a zero value of R.5G.5B1 ). So as far as procedural bitmap generation goes everything you need is already there.

On the other hand, every artist I know uses either Mudbox or ZBrush to create Normal Maps ( me included ).

K
kattle87
Posts: 402
Joined: Wed Sep 26, 2007 9:06 am
Location: Italy

Post by kattle87 »

he means generate a normal map by inputting a greyscale heightmap... I hate the normals I can even tell you why :D
They need a nice code much similar to the one the blur needs, but at the same time we are going to change the blur because of speed :D

Seriously speaking, creating a normal map is so easy it can even be done in a ZExpression... I don't think a component will be that usefull UNLESS used inside a BitmapLight component... and I was thinking about another way of implementing the light component itself.
but time will tell ^^ I'm going to try a lot of stuff in the upcoming weeks!
In the fall of 1972 President Nixon announced that the rate of increase of inflation was decreasing. This was the first time a sitting president used the third derivative to advance his case for reelection.
-=Hugo Rossi=-
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

Post by jph_wacheski »

Code: Select all

Mudbox = $795.00 CAD 
ZBrush =  $738.87 CAD
Seriously,. dude I would need thousands of dollars to use all the software you talk about! I am using ZGE because I like it and find it very powerfull, but also because I am poor,. and I have no resources to buy all these expensive corparate controlled concoctions,. (although I perhaps would consider, some, if I had the income) therefore I look to the opensource freeware alternatives. :) What I am after are simple systems that use some of the cool ideas and techniques that these expensive apps do, but in a simplfied and free way,. (as these ideas are mostly generated in acedemic papers, i.e open source ideas! and then implemented and corporatized). not just for money sake, but I think modern games are just too detailed for their own good,.(killzone2) and loose much of what makes games interesting and fun,. (simple systems and rules interactively attached to art)

Yeah I know a normal map is STORED as a bitmap however it is based on 3 axii of normal data,. not something that is easy to visualise,. let alone come up with an easy way to generate,. . attached is an simple test, just mixeing offset shapes.

Yup Kattle "generate a normal map by inputting a greyscale heightmap" tis' just what I mean! (wek,TG, et al) we'll see if your normal/light can be realised.., was looking at TG and the 'light' uses the normal map to render the lighting,. . so, seems to work in the reverse order to what I think you are saying? (sample_crystal.xml)
iterationGAMES.com
User avatar
jph_wacheski
Posts: 1005
Joined: Sat Feb 16, 2008 8:10 pm
Location: Canada
Contact:

.zgeproj normal generation test 1.

Post by jph_wacheski »

Code: Select all

Mudbox = $795.00 CAD 
ZBrush =  $738.87 CAD
Seriously,. dude I would need thousands of dollars to use all the software you talk about! I am using ZGE because I like it and find it very powerfull, but also because I am poor,. and I have no resources to buy all these expensive corparate controlled concoctions,. (although I perhaps would consider, some, if I had the income) therefore I look to the opensource freeware alternatives. :) What I am after are simple systems that use some of the cool ideas and techniques that these expensive apps do, but in a simplfied and free way,. (as these ideas are mostly generated in acedemic papers, i.e open source ideas! and then implemented and corporatized). not just for money sake, but I think modern games are just too detailed for their own good,.(killzone2) and loose much of what makes games interesting and fun,. (simple systems and rules interactively attached to art)

Yeah I know a normal map is STORED as a bitmap however it is based on 3 axii of normal data,. not something that is easy to visualise,. let alone come up with an easy way to generate,. . attached is an simple test, just mixeing offset shapes.

Yup Kattle "generate a normal map by inputting a greyscale heightmap" tis' just what I mean! (wek,TG, et al) we'll see if your normal/light can be realised.., was looking at TG and the 'light' uses the normal map to render the lighting,. . so, seems to work in the reverse order to what I think you are saying? (sample_crystal.xml)
Attachments
normal_generation_000.zgeproj
.zgeproj normal generation test 1.
(5.21 KiB) Downloaded 610 times
iterationGAMES.com
User avatar
Kjell
Posts: 1883
Joined: Sat Feb 23, 2008 11:15 pm

Post by Kjell »

Hey jph,

There are a couple of open / free alternatives to Mudbox / ZBrush, but haven't tried any of them. Blender seems to be the safest choice though. If you do have $100 to spare, Silo or Curvy3D seem to be solid choices.

But I agree, Mario 64 didn't have any fancy shaders ( not even skinning ) and that game still looks great.

And I understand that writing a expression to generate a height map might be easier then a normal map, but a Parallax shader ( the Doom3 thing ) actually uses a height map for it's "bump" effect .. not just a normal map. This is a different effect then the oZone3D example.

Just to be clear ..

http://en.wikipedia.org/wiki/Normal_mapping
http://en.wikipedia.org/wiki/Parallax_mapping

K
Post Reply