Page 1 of 3
Bump/Parallax Mapping -anyone have a working GLSL example?
Posted: Sun May 03, 2009 6:01 pm
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.?
Posted: Sun May 03, 2009 6:50 pm
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.
Posted: Sun May 03, 2009 8:13 pm
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
Posted: Tue May 05, 2009 1:56 pm
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.
Posted: Tue May 05, 2009 2:43 pm
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.
Posted: Tue May 05, 2009 3:17 pm
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
K
Posted: Tue May 05, 2009 3:43 pm
by kattle87
Guys do we still need the light component for the bitmap now that we got the bump mapping? ^^
Posted: Tue May 05, 2009 4:28 pm
by Kjell
...
In case the answer will be yes ( to my own question, not Francesco's ) .. here's the source
K
Posted: Tue May 05, 2009 6:52 pm
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
![Wink ;)](./images/smilies/icon_wink.gif)
Posted: Tue May 05, 2009 7:38 pm
by VilleK
Great example Kjell, very illustrative with the moving light, thanks for posting.
Posted: Tue May 05, 2009 7:40 pm
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
Posted: Tue May 05, 2009 7:47 pm
by kattle87
he means generate a normal map by inputting a greyscale heightmap... I hate the normals I can even tell you why
![Very Happy :D](./images/smilies/icon_biggrin.gif)
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
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!
Posted: Wed May 06, 2009 1:28 pm
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.
![Smile :)](./images/smilies/icon_smile.gif)
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)
.zgeproj normal generation test 1.
Posted: Wed May 06, 2009 1:30 pm
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.
![Smile :)](./images/smilies/icon_smile.gif)
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)
Posted: Wed May 06, 2009 2:36 pm
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