Shiny wet pavement?

Posted By: Orange Brat

Shiny wet pavement? - 04/23/04 22:59

What kind of a shader would be required for the just rained shiny wet pavement look? Is that possible with DX8?

http://www.zen45117.zen.co.uk/xsibase/beashading1.gif

http://www.3drender.com/sunday/images/cinema465.jpeg
Posted By: ventilator

Re: Shiny wet pavement? - 04/23/04 23:04

with environment bump mapping this effect could be achieved.
Posted By: Orange Brat

Re: Shiny wet pavement? - 05/08/04 06:16

Do I need different textures for the different surfaces when using the shader? For example, one for the ground around any lights that need to be "reflected" and some for the walls around them? I'm a little in the dark on this since I haven't really delved into it much.
Posted By: ventilator

Re: Shiny wet pavement? - 05/14/04 06:20

this effect would really be easy to do! the problem is that environment bump mapping doesn't work in a6 with nvidia cards...

basically you would just need a pavement texture, a bump map and a cube map for it. with a blend like 80% pavement texture and 20% bumpy reflections it would look wet. you could additionally mix in some colors, use gloss maps,...
Posted By: qwerty823

Re: Shiny wet pavement? - 05/14/04 06:26

This shouldnt be an A6 specific problem. Im wondering if the bmap_to_uv/bmap_to_normals are converting the internal texture to a format not supported by nVidia cards. I have a dll that will return the texture format when passed a bmap. When I get a chance, Ill see which format is used, and what other formats are available, and if possible, if i can convert to the others. If it works, I might need a test subject with an nVidia card to try it out.
Posted By: ventilator

Re: Shiny wet pavement? - 05/14/04 06:34

all i know is that my geforce4 shows EMBM perfectly well in games like far cry and several shader demos but there is no way to get it working with a6. it's a pity because EMBM is important for a lot of effects...

it would be great if you could somehow figure out what's wrong. i am ready to be test subject!
Posted By: ventilator

uv-offset texture formats - 05/15/04 00:17

i checked the texture formats a gf4 supports with the directx caps viewer.

maybe the following list of supported uv-offset formats is interesting? what does d3dusage_dmap mean? are there less nos with ati cards?

nvidia geforce4 ti 4200 -> d3d device types -> hal -> adapter formats -> d3dfmt_x8r8g8b8 (fullscreen) -> texture formats

Code:

texture formats 0 (plain) d3dusage_rendertarget d3dusage_autogenmipmap d3dusage_dmap
...
D3DFMT_V8U8 yes no no no
D3DFMT_L6V5U5 yes no no no
D3DFMT_X8L8V8U8 yes no no no
D3DFMT_Q8W8V8U8 yes no no no
...


Posted By: qwerty823

Re: uv-offset texture formats - 05/15/04 04:56

Just a few things to note:

Loading a bmp, the format becomes D3DFMT_R5G6B5 ( 23 )
Loading a tga, the format becomes D3DFMT_X8R8G8B8 ( 22 )

Calling bmap_to_uv(), makes it D3DFMT_V8U8 ( 60 )
Calling bamp_to_normals(), makes it D3DFMT_A8R8G8B8 ( 21 )



// Outupt from my bmap info dll, using a tga
Name: n_bmap
Bytespp: 3
Width: 256
Height: 256
Tex #1: W=256,H=256,FW=256,FH=256
F:22,T:1,U:0,P:1,S:262144,MST:0,W:256,H:256

Name: uv_bmap
Bytespp: 3
Width: 256
Height: 256
Tex #1: W=256,H=256,FW=256,FH=256
F:60,T:1,U:0,P:1,S:131072,MST:0,W:256,H:256

Name: n_bmap
Bytespp: 3
Width: 256
Height: 256
Tex #1: W=256,H=256,FW=256,FH=256
F:21,T:1,U:0,P:1,S:262144,MST:0,W:256,H:256


// Outupt from my bmap info dll, using a bmp
Name: n_bmap
Bytespp: 2
Width: 256
Height: 256
Tex #1: W=256,H=256,FW=256,FH=256
F:23,T:1,U:0,P:1,S:131072,MST:0,W:256,H:256

Name: uv_bmap
Bytespp: 2
Width: 256
Height: 256
Tex #1: W=256,H=256,FW=256,FH=256
F:60,T:1,U:0,P:1,S:131072,MST:0,W:256,H:256

Name: n_bmap
Bytespp: 2
Width: 256
Height: 256
Tex #1: W=256,H=256,FW=256,FH=256
F:21,T:1,U:0,P:1,S:262144,MST:0,W:256,H:256
Posted By: qwerty823

Re: uv-offset texture formats - 05/15/04 05:11

Quote:

i checked the texture formats a gf4 supports with the directx caps viewer.

maybe the following list of supported uv-offset formats is interesting? what does d3dusage_dmap mean? are there less nos with ati cards?




Are you using the Caps Viewer for DX8 or DX9? If your using the DX9 one, you maybe getting invalid results.

d3dusage_dmap has to do with the displacement mapping in dx9.

As to the ATI ones, my laptop has a 9600, and it shows all the below formats. I did notice that for my GeForce4 Ti 4200, i dont see D3DFMT_V8U8 for 16 bit fullscreen. Not sure if that is an issue or not.

Quote:


nvidia geforce4 ti 4200 -> d3d device types -> hal -> adapter formats -> d3dfmt_x8r8g8b8 (fullscreen) -> texture formats

Code:

texture formats 0 (plain) d3dusage_rendertarget d3dusage_autogenmipmap d3dusage_dmap
...
D3DFMT_V8U8 yes no no no
D3DFMT_L6V5U5 yes no no no
D3DFMT_X8L8V8U8 yes no no no
D3DFMT_Q8W8V8U8 yes no no no
...





Posted By: ventilator

Re: uv-offset texture formats - 05/15/04 05:22

yes, i have directx9 installed and i used the directx9 caps viewer.

...
do you think it makes sense to try using some other uv-offset format instead of D3DFMT_V8U8?
Posted By: qwerty823

Re: uv-offset texture formats - 05/15/04 05:39

Not sure, but you cant control what gets used when calling bmap_to_uv, unless you know of some other way.
Posted By: ventilator

Re: uv-offset texture formats - 05/15/04 05:40

oh! i thought converting bitmaps can be done with your dll?
Posted By: qwerty823

Re: uv-offset texture formats - 05/15/04 05:57

well, maybe. I did do something similar for increasing the depth/stencil buffer, but changing the depth/stencil buffer is quite a bit easier then swaping out one texture for the same texture of a different format.
Posted By: Steempipe

Re: uv-offset texture formats - 05/15/04 06:08

Quote:

Just a few things to note:

Loading a bmp, the format becomes D3DFMT_R5G6B5 ( 23 )
Loading a tga, the format becomes D3DFMT_X8R8G8B8 ( 22 )

Calling bmap_to_uv(), makes it D3DFMT_V8U8 ( 60 )
Calling bamp_to_normals(), makes it D3DFMT_A8R8G8B8 ( 21 )






The Miscrosoft BumpWaves.Cpp evidentally generates these:

Code:
 // Load the texture for the background image
if( FAILED( D3DUtil_CreateTexture( m_pd3dDevice, _T("Lake.bmp"),
&m_pBackgroundTexture, D3DFMT_R5G6B5 ) ) )
return D3DAPPERR_MEDIANOTFOUND;

// Create the bumpmap.
m_psBumpMap = CreateBumpMap( 256, 256, D3DFMT_V8U8 );
if( NULL == m_psBumpMap )
return E_FAIL;


Posted By: ventilator

Re: uv-offset texture formats - 05/15/04 06:19

has anyone tested if this bumpwaves example works on a geforce card? (i don't have the directx sdk installed...)
Posted By: Steempipe

Re: uv-offset texture formats - 05/15/04 06:21

The bumpwaves example will also tell you, in the window, if it is using straight FFP EMBM or using a vertex shader _ EMBM to do the projection.
Posted By: qwerty823

Re: uv-offset texture formats - 05/15/04 06:24

I dont have it installed on the machine that has my Gf4ti4200, but it is shared from another. Testing...


Nope, gives an error. Says cant load the required media. (not very helpful)
Posted By: Marco_Grubert

Re: uv-offset texture formats - 05/15/04 06:27

Bumpwaves works on GF3/4. Running with X8R8G8B8 format and Vertex Shaders.
Here's the relevant code:
Code:

Init:
// Create the bumpmap.
m_psBumpMap = CreateBumpMap( 256, 256, D3DFMT_V8U8 );
------
Renderstates:
m_pd3dDevice->SetTexture( 0, m_psBumpMap );
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSU, D3DTADDRESS_CLAMP );
m_pd3dDevice->SetSamplerState( 0, D3DSAMP_ADDRESSV, D3DTADDRESS_CLAMP );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_BUMPENVMAT00, F2DW( m_matBumpMat._11 ) );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_BUMPENVMAT01, F2DW( m_matBumpMat._12 ) );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_BUMPENVMAT10, F2DW( m_matBumpMat._21 ) );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_BUMPENVMAT11, F2DW( m_matBumpMat._22 ) );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_BUMPENVLSCALE, F2DW(0.8f) );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_BUMPENVLOFFSET, F2DW(0.0f) );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLOROP, D3DTOP_BUMPENVMAPLUMINANCE );

m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG1, D3DTA_TEXTURE );
m_pd3dDevice->SetTextureStageState( 0, D3DTSS_COLORARG2, D3DTA_CURRENT );

// Set up texture stage 1's states for the environment map
m_pd3dDevice->SetTexture( 1, m_pBackgroundTexture );
m_pd3dDevice->SetTextureStageState( 1, D3DTSS_COLORARG1, D3DTA_TEXTURE );
m_pd3dDevice->SetTextureStageState( 1, D3DTSS_COLOROP, D3DTOP_SELECTARG1 );
---------
Vertex shader:
vs.1.1

dcl_position v0
dcl_texcoord v1

m4x4 oPos, v0, c3 ; transform position to the projection space

; Compute vertex position in the camera space - this is our texture coordinates
dp4 r0.x, v0, c0
dp4 r0.y, v0, c1
dp4 r0.z, v0, c2

; Do the rest of texture transform (first part was combined with the camera matrix)
rcp r0.z, r0.z
mad oT1.x, r0.x, r0.z, c8.x
mad oT1.y, r0.y, r0.z, c8.y

mov oT0.xy, v1 ; Copy input texture coordinates for the stage 0;



@qwerty: make sure you have the paths set up correctly..
Posted By: qwerty823

Re: uv-offset texture formats - 05/15/04 06:29

I just thought of that (since it was running from a share), so it's copying over to the machine now.

Edit: Now that i have it local, it works. Sorry for the scare everyone!
Posted By: Zerodin

Re: uv-offset texture formats - 05/15/04 06:41

You know what?
A 'wet surface' shader could even be usefull for making zombies look nasty and slimey!
Posted By: qwerty823

Re: uv-offset texture formats - 05/15/04 06:47

It works for my Gf4ti4200 w.o using vertex shaders.
Posted By: Steempipe

Re: uv-offset texture formats - 05/15/04 06:49

Try this and see if something shows up other than black on the geforce. If it does... a screen??
water test 5
Posted By: qwerty823

Re: uv-offset texture formats - 05/15/04 06:57

That one works.
Posted By: alienheretic

Re: uv-offset texture formats - 05/15/04 07:02

works fine
Posted By: Steempipe

Re: uv-offset texture formats - 05/15/04 07:05

so..... this is where it gets weird, and some troubleshooting is needed. I should post the code in a new thread. I will post the bare minimum that runs on my ATI and also the water_test_5 code to show the differences.

BTW: thats how that version looks on my ATI too.
Posted By: Drew

Re: uv-offset texture formats - 05/15/04 08:25

runs on my gforce4!!!!! (didnt last time..black) will also test on my radeon9600 later...

GREAT JOB!!! so is this pretty universal then?
Posted By: Bird

Re: uv-offset texture formats - 05/15/04 08:46

Your da KING!!
This is the first nice watershader that works with my GeForce4 Ti 4200!!!!!!
Goooooood work!
Posted By: Marco_Grubert

Re: uv-offset texture formats - 05/15/04 09:34

It's bumpy on plain Geforce 3 as well. The textures look a little bland though- 16 bit ones ?
Posted By: Steempipe

Re: uv-offset texture formats - 05/15/04 09:42

Things have been so screwed up with that thing that I have not had the time to test different textures and different tweaks. The water_test_1 looks pretty nice on my ATI, the water_test_5 does look bland. But so far it was the only one to run on anything other than the ATI.

I hope that those with more knowledge than I can use the code as a start. To figure out what the heck is going on with these cards.
Posted By: Orange Brat

Re: uv-offset texture formats - 05/15/04 12:42

Quote:

Try this and see if something shows up other than black on the geforce.





Works fine on GFFX 5200 Ultra.
Posted By: Homey

Re: uv-offset texture formats - 05/15/04 13:20

Crashes on my old GEForce 256 with D3D error
Works on all my ATI cards though
Posted By: Steempipe

Re: uv-offset texture formats - 05/19/04 04:34

@Marco:

Quote:

It's bumpy on plain Geforce 3 as well. The textures look a little bland though- 16 bit ones ?




I guess it really did not matter what format my texture was since evidentally V8U8 is 16bit format and the texture had to be bmap_to_uv'ed.

This from MSDN:

Quote:

Signed Formats
Data in a signed format can be both positive and negative. Signed formats use combinations of (U), (V), (W), and (Q) data.

Signed format flags Value Format
D3DFMT_V8U8 60 16-bit bump-map format using 8 bits each for u and v data.
D3DFMT_Q8W8V8U8 63 32-bit bump-map format using 8 bits for each channel.
D3DFMT_V16U16 64 32-bit bump-map format using 16 bits for each channel.
D3DFMT_Q16W16V16U16 110 64-bit bump-map format using 16 bits for each component.
D3DFMT_CxV8U8 117 16-bit normal compression format. The texture sampler computes the C channel from: C = sqrt(1 - U2 - V2).




Posted By: Steempipe

Re: Shiny wet pavement? - 05/21/04 08:15

I hope that much of the GF/ATI texture issues are behind me for this one.

The card requirments:
-Support 3+ texes per stage
-VertexShader 1.1
-EMBM (Using the "BumpEnvMap" operation)

Having some issues with figuring out the best types of textures to use for this thing. As well as some trouble with this pixelation type of annoyance.



If you want to see if anything other than black or white shows on your card I have a build here:
The demo - approx 2.4MB
Posted By: Drew

Re: Shiny wet pavement? - 05/21/04 11:28

NICE! runs perfectly on my 9600mobile.
Is there anyway to get some movement of the lights or maps in any way? Or a way to keep a map camera aligned/locked so the highlight moves with the camera? (DRooool)
Steempipe, you are awesome for sharing, is the code coming soon? I really hope so! thanks!
Posted By: A.Russell

Re: Shiny wet pavement? - 05/21/04 11:40


Water now works on my GeForce FX5700:



Posted By: Orange Brat

Re: Shiny wet pavement? - 05/21/04 12:36

Shows up on my GFFX 5200 Ultra. Not bad. It would be interesting to see how it looks on a more common brick or concrete street.
Posted By: A.Russell

Re: Shiny wet pavement? - 05/21/04 15:14


I just tried the wet pavement shader as well.

It's very good, except that some of the pixels jitter around too much. If you could calm it down a little.
Posted By: Drew

Re: Shiny wet pavement? - 05/21/04 18:11

maybe mipmapping could help that?
I LOVE NEW SHADERS!

Posted By: slayer2k3

Re: Shiny wet pavement? - 05/21/04 21:18



works on my geforce 4 ti4200
Posted By: Steempipe

Re: Shiny wet pavement? - 05/22/04 04:11

Man.... So I moved the mipmap instruction from after the "bmap _to_uv" to before it. The dancing pixels disappeard, but so did the nice gloss effect. Hmmmmmmmm, I'll have to see what MS does.

FYI: This is essentially the same effect that the vs11/ffp EMBM water uses. This is what I have learned so far:
1). I can pass just about any texture format to the ATI card and the EMBM gets rendered. As a matter of fact, in some cases it looks better than the V8U8 tex.
2). For the GF cards it appears we need to convert the texture to V8U8 format using the "bmap_to_uv();" instruction.

Sidenote:
Any SDK people have any ideas to pass difffernt EMBM UV texture formats to our effects?? Can we even use DX to CreateTexture and use it in the effect??
Posted By: Drew

Re: Shiny wet pavement? - 05/23/04 14:14

'steempipe' and I have been working on the shader (well hes let me test it and throw suggestions at him , heres what it looks like in a pseudo game environment...No its not a real game or anything, just a test hall for the shader.
PLEASE report which cards wont run it or sees only black walls so Steempipe can work on it. He said:
"IMPORTANT: might not run on geforce cards.."

(controls: AWSD to move, mouse to fire...)

DEMO



Posted By: Orange Brat

Re: Shiny wet pavement? - 05/23/04 16:54

Everything works here.
Posted By: Aaron_H

Re: Shiny wet pavement? - 05/23/04 18:16

Working fine for me.
Although are some of the walls supposed to "melt" down and crawl across the floor like water? (My guess is that they are).


Posted By: Drew

Re: Shiny wet pavement? - 05/23/04 18:34

HEHE yes thats supposed to happen...I dont know why though.

Posted By: Guido_Richter

Re: Shiny wet pavement? - 05/23/04 20:45

Nice demo, nice shader, works fine @ GF 4 Ti 4200
Posted By: Steempipe

Re: Shiny wet pavement? - 05/23/04 20:53

I am glad that it is working on some GeForce cards, that takes one of the "mysteries" of applying the EMBM effect to those cards away. This is encouraging news.

The requirements are:
-Supporting (3) tex operations per pass
-EMBM utilizing the "bumpenvmap" operation.
-Using projective tex coordinates.

Keep testing! Drew did an excellent job of making that look nice!!
Posted By: Guido_Richter

Re: Shiny wet pavement? - 05/23/04 21:10

BTW: Can I have the code?Maybe I can make another screenshot showing the shader at the house i'am working on.
Posted By: Steempipe

Re: Shiny wet pavement? - 05/24/04 05:33

Sure.. I can give ya the code, but any advice on making it look "good" I do not have. For example; My screenshot compared to Drew's demo.

I'll get something PM'd to you soon....

Eric
Posted By: A.Russell

Re: Shiny wet pavement? - 05/25/04 01:45

.. and could I have your water shader?
Posted By: ChrispiZ

Re: Shiny wet pavement? - 05/26/04 08:20

Could you post the code up so you could share it with us?
I would happily accept the code
Posted By: ventilator

Re: Shiny wet pavement? - 05/26/04 08:29

this is a bit off-topic but something came to my mind regarding EMBM on geforce cards.

actually EMBM is fake reflection bump mapping.

per pixel environment mapping (=real reflection bump mapping) seems to work without problems with a6 and geforce cards! it should look even better than EMBM but the downside is that it is much slower.

this effect requires some matrix*matrix multiplications in the vertex shader. this is quite awkward to do with shader assembler and i have to figure out a way to do that first...
Posted By: Steempipe

Re: Shiny wet pavement? - 05/26/04 08:30

That's sounding interesting. Are you refering to something with texm3x3vspec?
Posted By: ventilator

Re: Shiny wet pavement? - 05/26/04 08:33

yes, it's texm3x3spec! the only thing i still have to figure out is how to do the matrix multiplication...
Posted By: Steempipe

Re: Shiny wet pavement? - 05/26/04 08:39

Hmmm... I was pondering today if this is where that freaking "var my_matrix[16];" thing coupled with the "matrix matMtl" would come in handy here. I decided to install MSVC 6 and get linked to the lib last night just in case it is needed.
Good luck!!! You tread deep waters!
Posted By: ventilator

Re: Shiny wet pavement? - 05/26/04 08:44

the matrix multiplication has to be done per vertex in the shader and not in the material event function.
Posted By: Steempipe

Re: Shiny wet pavement? - 05/26/04 08:48

Ahh yes, you did seem to state that in your first post. Sorry.
Well, I look forward to screenshots in the near future!!!

@ChrispiZ : Code will show up for the grabbing soon.

@A.Russell : The water code is posted in a different thread. You should be able to take what you need, discard the rest.
Posted By: ChrispiZ

Re: Shiny wet pavement? - 05/26/04 08:57

Aite, Thnx, Hope i can get it soon, i would love to mess with it.,
And how is it fake bumpmapping? I don't get it,
Posted By: Drew

Re: Shiny wet pavement? - 06/06/04 12:26

heres a demo Ive released as part of a tutorial, uses steempipe's reflective shader...may not show up on some geforce cards... its a subtle reflection that climbs along the walls of the cave...



Find the demo Here:
http://www.conitecserver.com/ubbthreads/showflat.php?Cat=&Board=UBB33&Number=389297&fpart=1&PHPSESSID=


.
Posted By: Steempipe

Re: Shiny wet pavement? - 06/07/04 10:13

Thanks for sharing your stuff!
Posted By: Orange Brat

Re: Shiny wet pavement? - 07/19/04 14:13

Here's the perfect example of the type of shiny wet pavement I had in mind. Assuming this is a realtime shot from the game, how in the world would you get that many shiny areas over such a wide area?

The Urbz: Sims in the City:

Posted By: sonic2nd

Re: Shiny wet pavement? - 07/22/04 03:43

Orange Brat. I was using the german english translator and google(since everytime I use altavista's one here, they make fun of me and vote me only 1 star.) So your name has always appeared as "Orange Roast" instead of "Orange Brat."

Anyway, this is the time it is probably best for you to use an alternative modeler. I demand that you use a 3d modeling program. Port the(ground) of your level into a 3d modeling program(3ds max for example.) Infact, port your entire level. Next, add glossyness, and realtime reflection(slightly.) Bake the reflection as if it is a texture, then port the(ground alone) back to 3d Gamestudio.
-------------
Please tell me what I am telling you makes sense. I'm unable to express my thoughts clearly today.
Posted By: Orange Brat

Re: Shiny wet pavement? - 07/22/04 05:57

That would be the easy way.
Posted By: sonic2nd

Re: Shiny wet pavement? - 07/22/04 13:21

Max2hgs is only about $18, I believe. Buy it.
Posted By: Orange Brat

Re: Shiny wet pavement? - 07/22/04 14:39

Well, I'd have to spend $3,500 to get MAX first, and I don't think I can do that right now. I have Gamespace which can do texture baking fine and there is a nice level exporter. However, this is about a shader and not baking. Baking would not be desirable if one required the shine effect to be realtime. The Sims pic I posted is most likely an in engine shot, though I could be wrong.
Posted By: MaxF

Re: Shiny wet pavement? - 07/24/04 13:40

Hi All

Works on ATI 9200 PRO 128MB - FYI


© 2024 lite-C Forums