Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DarkBASIC Professional Discussion / Pixel Shader That Warps UV

Author
Message
LeeBamber
TGC Lead Developer
26
Years of Service
User Offline
Joined: 21st Jan 2000
Location: England
Posted: 14th Aug 2006 02:24
Hi Guys,

As you might expect, I continue to run around like a headless chicken working on spinning all my plates. I found a snippet I was working on until I was pulled off it, with a request inside the code. I figured I would release the program publically, so the request can be read by someone other than myself. I know how to create a warping texture by shifting the UV data of a vertex on a model, but I would like a pixel shader 2.0 or 3.0 FX file that does the same, but inside the pixel shader (so the vertex UVs do not need to be changed). You can use algorythms and texture look-ups if you like. I could sit down and write it, but it takes me a very long time to create shaders from scratch so I figured it would not hurt to throw this challenge out. I have attached my program which includes some media to get you started. If I get the pixel shader I am after, and I use it in a demo I am currently writing, I will put up a small prize as a thankyou. No rush, I have lots of other little tasks that need doing. Happy coding!

"Small, smart, and running around the legs of dinosaurs to find enough food to survive, bedroom programmers aren't extinct after all "
david w
20
Years of Service
User Offline
Joined: 18th Dec 2005
Location: U.S.A. Michigan
Posted: 14th Aug 2006 03:05
Its missing some files.

lava_I.tga

lava_D.tga

If you upload those I will be able to run your sample program and then be able to see what you are trying to do. Thank you.
The WhiteDragon
22
Years of Service
User Offline
Joined: 14th Jan 2004
Location: unknown
Posted: 14th Aug 2006 13:43 Edited at: 14th Aug 2006 13:44
Change this:


into this:


and it'll work as it "should" I guess.

Think LeeBamber just forgot to change the names of images because .dds files are in that zip file
Anyway, nice effect (if it works they way it should, upside it's the UV warped image and down is the normal image without UV warping).

"Enjoy the moment... forget the past and the future. Eternity is here..."
Scraggle
Moderator
22
Years of Service
User Offline
Joined: 10th Jul 2003
Location: Yorkshire
Posted: 14th Aug 2006 14:18
Changing Lava_D to a dds is all well and good but surely there should still be a lava_I file?

The effects say what they are: Top is Vertex Level UV Warping and bottom is Pixel Shader UV Warping but with Lava_I changed to Lava_D there is nothing happening, just a scolling texture.


The WhiteDragon
22
Years of Service
User Offline
Joined: 14th Jan 2004
Location: unknown
Posted: 14th Aug 2006 14:51
Maybe, let's just see what Lee has to say.

"Enjoy the moment... forget the past and the future. Eternity is here..."
dark coder
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 14th Aug 2006 15:39 Edited at: 14th Aug 2006 15:40
After looking at it, its fairly obvious, lee basically wants to use a heightmap style texture to warp a texture being scrolled over it, think of it like gravity and the texture is metal filings, when the texture passes near these deep parts in the texture they will get distorted/warped/stretched towards it, and when using this for lava it will look really cool.

Hallowed are the ori.
Preston C
23
Years of Service
User Offline
Joined: 16th May 2003
Location: Penn State University Park
Posted: 14th Aug 2006 22:46
You know Dark Coder, that's a pretty good idea. I sent Lee a simple Cos/Sin UV Warping thing, and he said he liked it, but I'll see what I can do with that idea.

AMD64 X2 3800+ | 1 GB Ram | NVIDIA GeForce 6800 128MB
MSVC++ .Net 2003 | BlueJ | Wings3D | CharacterFX | Gimp v2.0
Formerly NWC_Omega

Login to post a reply

Server time is: 2026-06-05 03:44:44
Your offset time is: 2026-06-05 03:44:44