Home Technical Talk

UV...W?

polycounter lvl 9
Offline / Send Message
felipefrango polycounter lvl 9
So, I understand how UVW mapping works and how the U and V axis relate to the X and Y axis and whatnot, but...what IS the W axis? Is there any cool stuff we can do by messing around with it? I assume it comes into play with '3d textures' (don't know if this is an actual term) like cubemaps. Anyway, just curious about what the fuck this is and if this can be turned into something cool and useful.

:thumbup:

Replies

  • Stromberg90
    Offline / Send Message
    Stromberg90 polycounter lvl 11
    Not sure myself, but I know for procedural textures in 3ds apps the texture is created in 3d space.
    Like I remember when using cinema4D a long time ago, if you applied c4d's noise texture and moved the object in 3d space the texture changed.
  • Eric Chadwick
    Yep, W is the depth axis, like Z is to XY. Useful for 3D textures.

    Gets in the way sometimes if you're trying to Weld but your W distance is greater than your UV distance.

    I vaguely remember someone had a cool W trick for something or other. Sorry, maybe they'll repost...
  • Eric Chadwick
    3d textures are also called Volume Textures.
    http://msdn.microsoft.com/en-us/library/bb205579%28v=vs.85%29.aspx

    Not used very much in games because they usually take a lot of memory. I did some work with 3d textures, we used it to store a custom noise pattern for a volume smoke effect coming from a spotlight. Really a pain in the ass to make though, it needed to tile in all three dimensions, blargh!
  • felipefrango
    Offline / Send Message
    felipefrango polycounter lvl 9
    Hmmmm, the more you know. Thanks a lot guys! Still wondering if it could be used for something good in game art. Technically it's still an unused channel one could potentially store information in for free (considering the mesh has UVW coordinates, which is 99.9% of cases), isn't it? Can't think of anything I'd like stored that would make the memory gain be worth the hassle though.
  • ZacD
    Offline / Send Message
    ZacD ngon master
    You could use it like another vertex color, probably the most useful thing since vertex colors are very useful, I'm a little unsure why anyone would need 5 vertex color "channels" though, unless you want to blend 6 textures on a terrain or something crazy.
  • felipefrango
    Offline / Send Message
    felipefrango polycounter lvl 9
    Yeah, that's exactly what I thought. Maybe offsetting the UVW mapping along the W axis could be used to create some sort of interesting effect on an asset that uses a cubemap or something?
  • Eric Chadwick
    Well, cubemaps don't use W.

    I guess you could store other data there, but most exporters and engines simply strip it out.

    Maybe you could store something like vertex alpha there... monochrome per-vertex info. Physics info comes to mind (friction or bounciness or whatever), or sound data (dirt sound vs. rock sound).
  • felipefrango
    Offline / Send Message
    felipefrango polycounter lvl 9
    Well, cubemaps don't use W.

    I guess you could store other data there, but most exporters and engines simply strip it out.

    Maybe you could store something like vertex alpha there... monochrome per-vertex info. Physics info comes to mind (friction or bounciness or whatever), or sound data (dirt sound vs. rock sound).

    Hmm, now we're getting somewhere. Weights for animated vertex shaders too (rippling water or waving flag come to mind). Still, is it worth the hassle? Do vertex colors add that much memory overhead to make it worth the trouble of authoring this stuff into the W channel?
  • Ruz
    Offline / Send Message
    Ruz polycount lvl 666
    it's handy for render to texture/baking when you have uv islands on top of each other, rather than ofsetting the uv's by 1 , you can just adjust the w depth.
    I posted this yonks ago and its a very handy trick.
  • Eric Chadwick
    I remember you talking about this. How far do you push it on W for it to be ignored?

    As for hassle, I guess it's just a matter of finding or making tools to let you manipulate W as paintable vertex data. Then you also need an exporter that stores W instead of tossing it. And an importer for the engine that reads the W data.
  • felipefrango
    Offline / Send Message
    felipefrango polycounter lvl 9
    As for hassle, I guess it's just a matter of finding or making tools to let you manipulate W as paintable vertex data. Then you also need an exporter that stores W instead of tossing it. And an importer for the engine that reads the W data.

    Exactly, now, is it worth developing all this stuff instead of just using vertex colors straight away? I've always assumed they don't add much in terms of memory so as much as I like the idea of milking stuff to the very last drop it all sounds a bit overkill.
  • Eric Chadwick
    I doubt it's worth it, it would be a lot of work for something that's already supported via standard vertex color (3 channels of data) and vertex alpha (1 channel).
  • CrazyButcher
    Offline / Send Message
    CrazyButcher polycounter lvl 18
    @felipefrango
    if the render engine supports it, you can have a lot of per-vertex attributes encoding whatever you want. Hardware typically supports 16 x 128 bit per vertex (you can add even more through custom buffer fetching in shader), but of course it costs more time to fetch more data...
Sign In or Register to comment.