This Dot3 business that's coming in the next update

Blitz3D Forums/Blitz3D Programming/This Dot3 business that's coming in the next update

John Pickford(Posted 2003) [#1]
Is it really the same thing that the new Doom game is using? i.e. A better-than-bump-mapping technique?

Will I be able to create those effects myself?

Will it be possible to dynamically create and modify the normal maps?


Mustang(Posted 2003) [#2]
If it is what I think it is:

Will I be able to create those effects myself?


Yes. Using various free tools on the net like Photoshop plug-ins (heighmap bumpmap -> normalmap) or better solutions like hi-res object baked to lo-res object (with good UV-map)... take a look at this for example:

http://amber.rc.arizona.edu/lw/normalmaps.html

Will it be possible to dynamically create and modify the normal maps?


IMO, no. Too "computational expensive"... :)


BlitzSupport(Posted 2003) [#3]
I think only Mark can confirm the details -- dot3 texture blending apparently allows the above, but whether it'll be implemented so that we can do this... dunno yet.


John Pickford(Posted 2003) [#4]
I'm hoping Mark will reply to this.

I'm specifically interested in whether I can manipulate the data (quickly) within Blitz. For my stuff I have no interest in pre-calculated data\exporters etc.

For example Blitz plays sounds samples but doesn't allow us to manipulate them (unless you want to create files and reload them).


Mustang(Posted 2003) [#5]
I think only Mark can confirm the details -- dot3 texture blending apparently allows the above, but whether it'll be implemented so that we can do this... dunno yet.


True. I *hope* that it is implemented so that we can use normalmaps... would be so cool and it's actually not just a flashy thing because you can then make everything look nicer - and use LESS polygons at the same time!


HNPhan(Posted 2003) [#6]
this will definetly give the very needed facelift on the graphics side for Blitz3D


Shambler(Posted 2003) [#7]
A normal map is just another texture which uses the RGBA values to store XYZ vectors for lighting calculations, so it should be pretty easy/fast to alter it at runtime for dynamic effects.

I hope this is introduced *keeps everything crossed =)

The only drawback will be some of our graphics cards may not support it.


Gabriel(Posted 2003) [#8]
When this issue was discussed on BlitzCoder, there was similar confusion. I mentioned that Mark said there would be no bumpmapping ( yet ) and that it would seem odd to say no bumpmapping if what he really meant was "something way better than bumpmapping".

Mark's reply was this :

Sorry...terminology confusion.

By bumpmapping, I mean 'any technique that makes stuff look bumpy'.

The are quite a few ways to do this, with dot3/normal-map bumpmapping just being one of them.

Plain dot3 blending is simpler. It just performs a dot3 op with 2 textures, and is implemented as a new 'TextureBlend' flag. I have managed to make a few things look bumpy using this, but its currently pretty limited. However, I decided to leave it in because you never know what Blitz users might come up with!





So I guess we'll have to wait until we can try it out to see how bumpy is bumpy and how limited is limited.


John Pickford(Posted 2003) [#9]
So I suppose it comes down to whether or not 'normal mapping' is planned.

It sounds like it isn't.

Ahhh well. It would have been just what I'm looking for.


Codemonger(Posted 2003) [#10]
It will be added, Mark will have no choice. It is very easy to add, even to the current commands. I imagine it was never added before because, a long time ago in a different galaxy, it wasn't popular in most video cards. Now a $20 video card supports it. So it will be added.


CyBeRGoth(Posted 2003) [#11]
Hmm I dont think Mark will HAVE to add it :)

Be nice if he does tho, but there has been no real word from him about updates or anything that will be added to blitz for a while.


John Pickford(Posted 2003) [#12]
He mentioned that Dot 3 will be included in the next update (any day now).


sswift(Posted 2003) [#13]
I'm confused and concerned now.


"I mentioned that Mark said there would be no bumpmapping and that it would seem odd to say no bumpmapping if what he really meant was "something way better than bumpmapping".

"By bumpmapping, I mean 'any technique that makes stuff look bumpy'. There are quite a few ways to do this, with dot3/normal-map bumpmapping just being one of them."



Does Mark mean here that when he said no bumpmapping, he meant Bltiz would support no methods at all to make stuff look bumpy?


"Plain dot3 blending is simpler. It just performs a dot3 op with 2 textures, and is implemented as a new 'TextureBlend' flag. I have managed to make a few things look bumpy using this, but its currently pretty limited."


What does "a dot3 op with 2 textures" mean? Does that mean blending a dot3 texture with a regular texture? Or does that mean two textures are required for the dot3 operation?


The fact that he says it's "pretty limited" and that he "managed" to make a "few" things look bumpy does not bode well for this being the same Dot3 blending that Doom 3 uses.


I cannot find many pages on the web which refer specifically to the "dot3 blending" term that Mark used. So I cannot find out about this alternative Dot3 technique which he seems to be using.


Well if this isn't Doom 3 Dot3 then Mark has some damage control to do... Why didn't he say anything when people were talking excitedly on the forums about doing what Doom 3 does? I was describing to everyone how Dot3 blending works in Doom, and others were posting utlilities to make Dot3 blending maps... Ugh.

Well, maybe this alternative effect will allow you to do some cool stuff. I want to know what exactly it does now.


JoshK(Posted 2003) [#14]
Does it matter? All it's going to be used for is a couple of bumpy box tech demos.


sswift(Posted 2003) [#15]
I've read up on Dot3 blending some more and I found some information which appears to indicate that this MIGHT be the same Dot3 blending that Doom 3 uses, but that in order to use it for normal maps, you need to do some OTHER special operations.

For example, I see some sites mentioning pixel shaders, and "normalized environment maps" and other sites mentioning storing the light direction in the vertex colors, but that keeping these values normalized is difficult if not impossible.

I presume that this means that to actually use Dot3 blending for normal maps you need to take extra steps beyond simply sticking the map into a texture channel and telling it to multiply ot add blend the shading calculated by the card with the texture.

Damn.

I think this means that it will be difficult to use this normal mapping without the support for pixel shaders in Blitz, which is a moot point because that would mean the effect wouldn't work on most people's cards since only newer cards have pixel shaders.

There's still hope though. I did see mention of using environment maps. So maybe it is possible to take the normal maps and blend them with a cubic map applied to your model which has the colors in it set to a normal map with normalized colors which indicates the direction of the light source?



I think I'm starting to understand how this Dot3 blending works actually.

Let's say that these Dot3 maps are just maps of how the normal changes across a surface.

Now when you rotate your object, these colors don't change. So they're always relative to the surface beneath. So, you need a way to first convert them to global space.

You would do this I suppose, by blending them with another color, and possibly renormalizing them?

Now once you've done that...

A dot product is a value between -1 and 1 which indicates how much two vectors point towards eachother.

So if you have blended your surface normal map, with another map to rotate those normals into global space instead of surface space, then if you perform a dot3 blend with a LIGHT vector, then the result will be that any pixels that point towards the light will have a value of 1, ie, 255, and any which point away will have a value of 0..-1, which all get clamped to a color of 0.

Maybe I'm overcomplicating things though. Maybe there is a way to convert a light's normal to surface space and then blend with that. Hm... You'd have to do that for each surface in the model.

Actually, I think I'm mistaken. Those normal maps aren't in surface space. They're all in the same space. In object space. The space of the object the map is applied to. That means they all need to be rotated the same way to get them into global space.

It's like a TformNormal Vx, Vy, Vz, Object, 0 operation on each pixel.

Hm...

So what you REALLY need to do is convert the light's normal into object space. Then you have to generate a normal map which represents this, and then you dot3 blend the object with this map.

But why do you need a map? You only have one light normal. You only need a single color for the light that represents it's normal... don't you? Hm...

So you take this one color, and you dot3 blend the object's normal map with it, and each pixel should get set to 255 or 0 depending on which way the light's normal points relative to the normal at each pixel.

I wonder if that's right? I'm not sure. It seems a lot simpler than the methods I saw people discussing. But it seems to make sense if dot3 does what I think it does.


sswift(Posted 2003) [#16]
I just thought of one issue which the method I described has though. If you could do that, then it would work fine for world geometry, but any skinned model where the normal map is twisted and rotated off the model's axis would not work right, as the normals would represent only how the surface is angled realtive to the model's space.


Codemonger(Posted 2003) [#17]
Are the 3D online doc's down because an update is on the way ?


DH(Posted 2003) [#18]
Well if this isn't Doom 3 Dot3 then Mark has some damage control to do... Why didn't he say anything when people were talking excitedly on the forums about doing what Doom 3 does? I was describing to everyone how Dot3 blending works in Doom, and others were posting utlilities to make Dot3 blending maps... Ugh.


It all boils down to communication, which Blitz seems to be loosing with its community. Either you keep communication with your community (and your community is happy to know your alive), or you ignore them and turn into DB.

Damage control? Hardly, more of a bunch of "dammits" cluttering the forums.. Blitz effects do need a serious facelift to stay ahead of the game, however I for one am still optimistic I can do something decent going by what he has said (regardless of how limited he was when he said it).


Shambler(Posted 2003) [#19]
@sswift yes thats pretty much it, it is very simple.

All you need is a texture which represents a bumpy surface, you could use 128*128 or 512*512 plus, depending on how detailed you want it.

Then at runtime all you do is tell DirectX where the light is coming from and it uses the dotproduct of this light and the normals in the bumpmap to generate in realtime a bumplit? surface =)

The light vector is stored as an RGBA colour so that it can be accessed using a texture factor by DirectX.

Nothing else for the programmer to do its all hardware accelerated...can't wait ^^


sswift(Posted 2003) [#20]
But HOW do you tell it this normal? That's what I was debating. It sounds to me like you need to dot blend this normal map with another normal map or a solid color to get an effect. And you can't use a solid color for the light direction if the geometry deforms, and, I realised since my last post, that you can't use a solid color with point lights, only with directional lights, because you have cases like a long wall with a light near the middle... the normal from the light to the wall is different along the whole length of the wall. Only with directional lights could you get away with using a single light normal.


"however I for one am still optimistic I can do something decent going by what he has said"

Oh don't get me wrong. I'm still looking forward to playing with it. If I have to invent an entirely new method of rendering to make use of it, so be it. :-)


Miracle(Posted 2003) [#21]
Every single thing I've ever read about DOT3 talks about bump mapping as if it's the only thing DOT3 can do. I think I need to see pictures of DOT3 doing something other than bump mapping before I can understand why I should even get excited about this in the first place.


sswift(Posted 2003) [#22]
I'm pretty sure this is what DOT3 does:


T1rgb = Texture 1 color
T2rgb = Texture 2 color

For each pixel:


DP# = (T1r# * T2r#) + (T1g# * T2g#) + (T1b# * T2b#)


In other words, the RGB of your texture contains the XYZ of a normal, with each component scaled from -1 to 1, to a range of 0 to 255.

Now when you do the above function, if these normals point in the same direction, you'll get a value of 1.

However, if these normals point in opposite directions, you'll get a value of -1.

And if the normals point 90 degrees away from one another, then you'll get a vlaue of 0.


This value is then converted to a greyscale pixel color, where any value below 0 is clamped to 0,0,0, and a value of 1 becomes 255,255,255.

So when you do this dot3 between one texture and another or the texture and the model color, you can blend the resulting shade with a texture to darken or lighten it.


Of course I have never actually used Dot3 and this is all speculation based on what I have read so far, but it seems to fit the data.


As for what you can use this for besides "bumpmapping"? I dunno. It is really mainly intended for bumpmapping. But who knows what other effects you can achieve using that equation. The dot product is used for a lot of things in 3D graphics.

It may be possible to use this for cel shading. Perhaps you can use it to create outlines on characters. Or maybe you could use it to blend your character in a way similar to a spherical map to create an x-ray like effect. I'm not sure.


Mustang(Posted 2003) [#23]
Sswift, there are two kinds of normal maps (generally used), "object space" and "tangent space". Object space ones are bit useless as you can't easily re-use those (rotate etc objects)... maybe good for levels etc stationary stuff that does not repeat but tangent space ones are good for almost everything, like (boned/skinned) characters and repeated objects like masses of cargo boxes or whatever.

Old .ppt but it explains this somewhat:

http://developer.nvidia.com/attach/1698


Litobyte(Posted 2003) [#24]
I like vertex weight support more then DOT3


Codemonger(Posted 2003) [#25]
Can't you do vertex weight manually ... anyway i'm upset that dot3 did not come out in this version, as far as i can tell. dot3 is awesome, it's been around at least since directx 7 SDK (i don't know about 6?). I think it would give blitz a big boost to have this feature, not because it's all the big rage but it does give off a simple effect to compete with anything in the future ... halo on the xbox uses this feature, it's nothing new. If you look down on the ice, you will notice indentations, it gives a real nice perception of depth as opposed to using a displacement map which increases the polygon count of an object by a thousand times.

I am really shocked it did not come out this time around, maybe Mark is doing some tweaking or something.


Litobyte(Posted 2003) [#26]
ok let's vote for:

1.86 dot3
1.90 fast blended vertex weights animations

:D


Shambler(Posted 2003) [#27]
Don't miss this guys...

http://www.blitzbasic.com/bbs/posts.php?topic=25741


^^


JaviCervera(Posted 2003) [#28]
ok let's vote for:

1.86 dot3
1.90 fast blended vertex weights animations
And what between those two version? I vote for stencil shadows.


Ross C(Posted 2003) [#29]
Ever see tho in Halo, multiplayer, the Sidewinder map (the ice one), that what's reflected in the ice is nice green hills. Only thing is, the scenary is not nice green hills :)


Rob(Posted 2003) [#30]
the dot3 stuff seems to work doom3 style. just got some meshes up and running


John Pickford(Posted 2003) [#31]
That's great news Rob. Could be exactly what I need for my next project.