How to acheive this effect with shaders
Is it possible to make 3d objects using opengl and shaders look something like this, I know you could do it by calculating the lighting yourself and drawing lines instead of polygons, but I wonder if there's a way you could do it in realtime with shaders.
Sir, e^iπ + 1 = 0, hence God exists; reply!
Automatic texture coordinate generation perhaps?
Use it to map a 1D contour texture onto the pipes. There's an example of that near the end of the red book's texturing chapter.
Use it to map a 1D contour texture onto the pipes. There's an example of that near the end of the red book's texturing chapter.
Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
yes, I think this might be just the thing.
Thanks!
Thanks!
Sir, e^iπ + 1 = 0, hence God exists; reply!
After a bit of reading about the various ways to do texture generation I think what I need to do is texture projection.
Im having a lot of trouble finding anything useful on the net about this though, anyone know any good resources where I can learn how to do this?
Im having a lot of trouble finding anything useful on the net about this though, anyone know any good resources where I can learn how to do this?
Sir, e^iπ + 1 = 0, hence God exists; reply!
Skorche: cool idea, mind if I extend it a bit?
Unknown: Grab this:
1D texture. (It's not really 1D - just scale it down or crop it. I had to make it wider to show up in Safari) Then, you generate your texture coordinates by hand. It will be really simple.
You want the texture coordinates to run from 0 to 1 over the "depth" of your pipe. So, the furthermost vertex of your pipe should have a texture coordinate of zero, and the closest 1. To do this, just iterate over the object's vertices and find the min and max Z values. Then, calculate the "thickness" or "depth" of the pipe: float thickness = maxZ - minZ; Then, iterate over the vertices again, and find the texture coordinate like so: texCoord = (currZ - minZ) / thickness;
This will texture your object as if the texture was projected from above. (This assumes that Z is pointing into the screen, and you may have to swizzle the coordinates or rotate the texture 90°, but you'll figure it out). What's even cooler: lighting will work, as will vertex coloring.
Unknown: Grab this:
1D texture. (It's not really 1D - just scale it down or crop it. I had to make it wider to show up in Safari) Then, you generate your texture coordinates by hand. It will be really simple.You want the texture coordinates to run from 0 to 1 over the "depth" of your pipe. So, the furthermost vertex of your pipe should have a texture coordinate of zero, and the closest 1. To do this, just iterate over the object's vertices and find the min and max Z values. Then, calculate the "thickness" or "depth" of the pipe: float thickness = maxZ - minZ; Then, iterate over the vertices again, and find the texture coordinate like so: texCoord = (currZ - minZ) / thickness;
This will texture your object as if the texture was projected from above. (This assumes that Z is pointing into the screen, and you may have to swizzle the coordinates or rotate the texture 90°, but you'll figure it out). What's even cooler: lighting will work, as will vertex coloring.
You could also render edges in OpenGL with rounded blocks, that oughta look just like it, the impossible intersections might be a bit tricky though.
I've had some success trying to render a torus with Fenris's idea, I haven't managed to get it looking quite right though. I think I need to take surface normals into account instead of z components but I get strange results when putting the dot product of the normal and lightsource direction normal into the range 0-1.
What do you mean by rounded blocks DoG, would I draw each curved part as a seperate block and have it already texture mapped or something else?
What do you mean by rounded blocks DoG, would I draw each curved part as a seperate block and have it already texture mapped or something else?
Sir, e^iπ + 1 = 0, hence God exists; reply!
I believe he's saying that you could light the scene from all 4 sides rather than from above, and where you want the contour lines to appear you would put a little ridge in the geometry. The cross-section of the pipe might look something like this:
But the verticals would have to be slightly slanted rather than vertical, so that from above you'd see them catching the light.
Textures would be a computationally cheaper solution if you can get them to work.
With either technique once you got some building blocks done you could build up a larger scene without too much effort, assuming the geometry is fairly repetative (which the picture above isn't.)
Code:
_____|
_|
_|
|Textures would be a computationally cheaper solution if you can get them to work.
With either technique once you got some building blocks done you could build up a larger scene without too much effort, assuming the geometry is fairly repetative (which the picture above isn't.)
Measure twice, cut once, curse three or four times.
I hope this means your making an OS X sequel to System's Twilight.
"Yes, well, that's the sort of blinkered, Philistine pig-ignorance I've come to expect from you non-creative garbage."
I meant that you can get OpenGL to render edges of polygons you specify, so if you draw cylinders, viewed from the side, and you use a regular subdivision, then you could just draw all the lines along the length of it. Or, you could just draw the lines separately and fill in the z-buffer with black polygons so that occlusion is right.
unknown: I just wanted to clarify: you'll need the normals for lighting, but the texturing should be done in z-space only.
Lesure Suit Lurie Wrote:I hope this means your making an OS X sequel to System's Twilight.Well, I know I couldn't match up to the greatness of System's Twilight but I am thinking about making a story based puzzle game of the same ilk.
I think I just worked out how to do it, its a combination of Fenris and DoG's methods.
I can get the polygon edges z-depth and then use the texture for a lookup to decide whether or not to draw an edge.
Sir, e^iπ + 1 = 0, hence God exists; reply!
Possibly Related Threads...
| Thread: | Author | Replies: | Views: | Last Post | |
| Using blending for a text fading effect. | cjcaufield | 2 | 3,486 |
Jun 30, 2010 08:21 PM Last Post: cjcaufield |
|
| Halo-Effect in 3D OpenGL ES | Bersaelor | 4 | 4,718 |
Dec 17, 2009 11:54 AM Last Post: Mark Levin |
|
| How to do a Quick, Dirty bloom effect FAST! | Oddity007 | 12 | 6,927 |
May 9, 2009 09:42 AM Last Post: aardvarc |
|
| malloc particle effect (glDrawArray) | Graphic Ace | 1 | 2,681 |
Mar 15, 2009 03:13 PM Last Post: maximile |
|
| GLSL geometry- and multipass-shaders (nogo?) | mcMike | 3 | 5,070 |
May 2, 2008 05:51 AM Last Post: mcMike |
|

