|
Parallax mapping is an enhancement to normal mapping. Normal mapping
suffers greatly from sharp angles between geometry and camera, since the
detail simulated through the normal map does not occlude itself, as real
gemoetry detail would. Parallax mapping tries to simulate this effect by
shifting the texture coordinates relative to the camera/geometry angle
to make the normal map kind of occlude itself. It works really well,
though I've only seen it implemented in some game engines so far... I
have to admit though that I haven't touch the highly acclaimed ZBump
yet, since we don't do mr rendering work...
Normal mapping and bump mapping are practically the same thing, btw. And
I'd say it certainly has its place in the production pipeline. It always
depends on what you want to achieve and what possibilities the toolset
offers.
Cheers,
André
Tim Leydecker wrote:
How about parallax mapping, can you shed some
light on that technique?
It seems there´s all sorts of workflows superior to the
more traditional bumpmap implementation, starting with
Ben´s ZBump, various ways of Normalmapping and last
but not least just tesseleating the mesh to infinity and using
a displacement instead - or even a vector displacement.
Problem is, as allways, the limited information available
like, "now is that stored in float or clamped8bit..."
Pretty hard to get to a point of confidential usage then,
or as you´ve put it - use it in production asap.
Cheers
tim
----- Original Message ----- From: "André Adam" <a_adam(at)49games.de>
To: <XSI(at)Softimage.COM>
Sent: Friday, January 26, 2007 9:58 AM
Subject: Re: tangent maps
I've a whole bunch of programmers around here that got headaches
because of those alpha values; actually we did not find out up to now
and my personal opinion still is it simply is trash (though I'm the
only one over here with that opinion...). Anyone from Soft like to
give us a hint?
That only 8bit data thing for the tangents is odd, since they use
float arrays... on the other hand, that whole normal mapping
technique is unprecise as hell anyways, so I guess nobody will ever
notice... ;)
Ben Rogall wrote:
Thanks for forwarding that Andre. The hardest part about the vector
displacement was setting up the tangent space conversion. Well, that
and trying different ways of exporting objects and mapping the
position data. Mental Ray already knows how to do multi-directional
displacement.
Regarding the bit-depth of the tangent property, if I read out any
of the values, say by checking the SDK explorer and multiply by 255,
I get a whole number. Btw, I have no idea what is being stored in
the alpha channel.
--- On Thu 01/25, =?ISO-8859-1?Q?Andr=E9_Adam?= < a_adam(at)49games.de
> wrote:
*From: *=?ISO-8859-1?Q?Andr=E9_Adam?= [mailto: a_adam(at)49games.de]
*To: *XSI(at)Softimage.COM
*Date: *Thu, 25 Jan 2007 17:32:02 +0100
*Subject: *Re: tangent maps
Hi Ben,
thanks for the kind words! Very nice work on the displacement
mapping!
A vertex colour property stores float values, not 8bit data, so
you're
practically lossless when converting back to vectors. The smoothing
works similar, since it is angle based, but is not connected in
any way
to the geo approximation or the normals. In theory, the normal map
should be able to compensate cracks in the tangent space, but
practically the normal map's texels would have to line up
perfectly with
the polygon edges which is a very unlikely occasion. So, as soon
as you
try to fit a normal map texture with its pixel raster onto
uneven 3d
geometry, the tangent space needs to be smoothed to avoid cracks
and seams.
I've attached the script to this mails, but really, this is nothing
fancy, just a one-time creation of null objects pointing in the
vector's
direction. A compiled operator with live-input certainly would
be way
nicer. Oh, and it is slow, be careful with meshes heavier than -
say - a
thousand polygons, trying it out on small objects will be more
fun... :)
Cheers!
-André
Ben Rogall wrote:
>
> Andre, very very nice explanation. I've been using XSI tangents
> recently in experiments with tangent space vector displacement:
>
http://www.xsibase.com/forum/index.php?board=29;action=display;threadid=28834;start=0
> It took me a little while to realize I had to do the [0,1] to
[-1,1]
> interval correction. I'm also curious to see whether having
only 8
> bits per channel for the tangent vector is enough to avoid
jumping
> though I haven't seen anything obvious yet.
>
> Another issue with tangent space is difficulty when you try to
get
> different 3D applications to work with eachother. Once you
have the
> normal and tangent vectors, there are still several ways to
determine
> your T,B,N space depending on which of these vectors you
decide to
> orthoganalize to the others. This choice has to match between the
> applications.
>
> I hadn't even thought about the smoothing issue you mentioned.
Is that
> analogous to the normal automatic discontinuity control?
>
> Also is your tangent display utility publicly available?
>
> Thanks,
> Ben
>
>
> --- On Thu 01/25, =?ISO-8859-1?Q?Andr=E9_Adam?= <
a_adam(at)49games.de >
> wrote:
>
> *From: **=?ISO-8859-1?Q?Andr=E9_Adam?= [mailto:
a_adam(at)49games.de]
> *To: *XSI(at)Softimage.COM
> *Date: *Thu, 25 Jan 2007 11:20:09 +0100
> *Subject: *Re: tangent maps
>
> Hi Bernard,
>
> the tangent property in XSI is the so called tangent map, or
tangent
> space. Encoded in there you can find a given texture space's
> u-direction
> (the reason why you have to reference a texture projection when
> creating
> a tangent property) in 3d space (you could call this the "texture
> mapped" u-direction) on a per sample basis, so we're talking of
> vectors
> here. In absence of a more convenient property Softimage
decided to
> encode the tangents into vertex colors. That means you have a
> little bit
> of math to do to revert them back to vector data: (VC-0.5)*2.
This
> formula stretches the RGB vertex color values, which have a 0-1
> range,
> back to a vector's -1 to +1 range.
>
> The reason you need a tangent space when dealing with normal
maps is
> that a "normal map in tangent space" (there is also an object
> space flavour)
> stores relative information as to where a given normal should be
> bent,
> which after all is what bump mapping is all about (bump
mapping and
> normal mappinng are practically the same thing). The lila-blueish
> color
> in a tangent space normal map means that the geometry's input
normal
> should not be altered, where cyan, magenta, etc colours
indicated a
> shift in normal orientation.
> This shift, which is a relative bit of information as it does not
> point
> to global world coordinates, needs a reference on the object
> itself from
> which the relative shift should be calculated - the tangent
space.
> The
> tangent space offers a predefined vector for each sample point
and is
> directly generated from the texture projection the normal map is
> mapped
> with onto the object.
>
> I've written a small utility that creates little pointers from
the
> tangent space right on the object's surface to better show the
> vectors
> encoded there. I've attached two screenshots which might clearify
> that a
> bit. The first one shows a straight spherical mapping, the second
> one is
> twisted. As soon as a texture space shows distortions (or even
worse:
> seams), just like the second one, tangent spaces become
tricky; the
> samples for a single vertex point in different directions, which
> finally
> would create artifacts during normal mapping. To cope with this
issue
> the tangent operator in XSI has a smoothing value, which
basically
> middles the different sample's tangent vectors using an
angle-based
> approach.
>
> Since the normal map stores its data relative to the tangent
space,
> generation, as done with the ultimapper for example, therefore
always
> needs to reference it during generation to provide correct
results.
> Ultimapper basically marries referenced object curvature from
a high
> resolution source object with the normals of the low resolution
> source
> object and the tangent space of the low resolution object.
>
> The Photoshop plugins and tools provided by graphics hardware
vendors
> don't have this kind of 3d information available when generating
> normal
> maps from heightmaps. They assume that the object the generated
> normal
> map might get mapped onto shows an ideal tangent space, which
> usually is
> nonsense. The more distorted the texture space on the mapped
> object is,
> the wronger (is that english?!) the bump mapping results with
such a
> textures are. I'd stay away from these tools for production work.
>
> Hope that makes some sense, cheers!
>
> -André
>
/*========================================================
"Show Tangents" / André Adam
Tool to create null object pointers on an polymesh object's surface
to visualise direction in a tangent space.
========================================================*/
function fGetPointer(oObj, oSize){
var oNull, oDisplay
oNull = oObj.AddNull();
oNull.Parameters("Primary_Icon").Value = 9;
oNull.Parameters("Size").Value = oSize;
oDisplay = oNull.AddProperty("Display Property");
oDisplay.Parameters("wirecol").Value =
Math.round(Math.random()*1023);
return oNull;
}
function fGetTangents(oPolyMsh){
var eVCs = new Enumerator(oPolyMsh.VertexColors);
while(!eVCs.atEnd()){
if(eVCs.item().Name == "Tangents"){
return new VBArray(eVCs.item().Elements.Array).toArray();;
}
eVCs.moveNext();
}
return false;
}
function fGetSamplePositions(oPolyMsh){
var aSamplePositions = new Array();
var ePoints = new Enumerator(oPolyMsh.Vertices);
for(var i=0; i
ePoints.moveFirst();
while(!ePoints.atEnd()){
var eSamples = new Enumerator(ePoints.item().Samples);
while(!eSamples.atEnd()){
if(eSamples.item().Index == i){
aSamplePositions.push(ePoints.item().Position);
}
eSamples.moveNext();
}
ePoints.moveNext();
}
}
return aSamplePositions;
}
function fShowTangents(oObj, oSize){
var oPolyMsh = oObj.ActivePrimitive.Geometry;
var aTangents = fGetTangents(oPolyMsh);
if(aTangents){
var aSamplePositions = fGetSamplePositions(oPolyMsh);
for(var i=0; i var vY =
XSIMath.CreateVector3((aTangents[i]-0.5)*2,
(aTangents[i+1]-0.5)*2, (aTangents[i+2]-0.5)*2);
var vX = XSIMath.CreateVector3(0, 1, 0);
var vZ = XSIMath.CreateVector3();
vZ.Cross(vY, vX);
vX.Cross(vY, vZ);
vX.Normalize(vX);
vY.Normalize(vY);
vZ.Normalize(vZ);
var oM3 = XSIMath.CreateMatrix3(vX.X, vX.Y, vX.Z, vY.X, vY.Y,
vY.Z, vZ.X, vZ.Y, vZ.Z);
var oTrans = XSIMath.CreateTransform();
oTrans.SetRotationFromMatrix3(oM3);
oTrans.SetTranslation(aSamplePositions[i/4]);
oTrans.SetScalingFromValues(0.25, 1, 0.25);
var oPointer = fGetPointer(oObj, oSize);
oPointer.Kinematics.Local.Transform = oTrans;
}
}
else{
LogMessage("aa_ShowTangents: No tangents found on object!",
siError);
}
}
/*========================================================
MAIN
========================================================*/
if((Selection.Filter.Name == "object") && (Selection.Count == 1)
&& (Selection(0).Type == "polymsh")){
fShowTangents(Selection(0), 1);
}
else{
LogMessage("aa_ShowTangents: Not a single polymesh object
selection!", siError);
}
---
Unsubscribe? Mail Majordomo(at)Softimage.COM with the following text in body:
unsubscribe xsi
|