Home Technical Talk

Lightmap/AO 3dsmax second uv question

polycounter lvl 18
Offline / Send Message
Jeremy Lindstrom polycounter lvl 18
http://boards.polycount.net/showthread.php?t=54150&page=2

I thought someone was working on a tut for this, but guess it got backburned. :D

just for noob sake, trying to figure this out I went ahead and followed this tutorial

http://www.game-artist.net/forums/vbarticles.php?do=article&articleid=37

I created a simple box with an intersection, uv mapped it and applied a tiling texture to it.

I then collapsed the stack.

I then created a secondary uv set on channel two, applied a grey texture to the boxes and then rendered to texture following that tutorial and created a AO map.

Now, i have questions, do I need to keep both unwrap uvw's or can i collapse them.

Secondly, how can I add that to a shader in max? Via the emissive channel? A dx shader? Where do i select the uv set to use?

Any help would be appreciated, I think Lee's going to help me with it in Unreal, but I'd like to know how ot show it up in max as well. Thanks.

Replies

  • Eric Chadwick
    Dekard wrote: »
    do I need to keep both unwrap uvw's or can i collapse them.
    Yes. In fact, you should collapse often in Max, for better stability. Collapsing UV modifiers does not remove the UVs.
    Dekard wrote: »
    Secondly, how can I add that to a shader in max? Via the emissive channel? A dx shader? Where do i select the uv set to use?
    Depends on the shader, you need one that supports multiple UVs.
  • Jeremy Lindstrom
    Offline / Send Message
    Jeremy Lindstrom polycounter lvl 18
    thanks, here's where I'm at:
    test3.jpg

    I got the two uv sets working, but it just doesn't look like I'm putting the AO bake in the right slot. I thought I was supposed to be putting it in the emissive slot but maybe this would all be easier if I rendered it in unreal instead of trying it in max?

    thanks again.
  • Eric Chadwick
    If the object's textures do not tile, then the AO should be simply multiplied into the diffuse bitmap. However if you're tiling textures, then you need a shader that either: 1) multiplies an emissive AO (instead of doing the usual additive), or 2) multiplies a diffuse AO with the regular diffuse.

    Edit, here's a shader you could use.
    http://www.bencloward.com/shaders_globalIllum.shtml
  • joe gracey
    Offline / Send Message
    joe gracey polycounter lvl 11
    If my model has overlapping UV's, can I do a second unwrap in a second map channel for an AO map? I'm sure this question was answered, but I just wanted to clarify for myself.
  • Jeremy Lindstrom
    Offline / Send Message
    Jeremy Lindstrom polycounter lvl 18
    Yes, that was what I'm doing. I use the original uv map on channel 1 and then create a second uv set for the ao bake.

    like this:

    http://boards.polycount.net/showpost.php?p=821730&postcount=25

    The bridge is tiling the texture then he autounwraps and bakes out a smaller ao bake
  • Eric Chadwick
    In EarthQuake's bridge example, it looks like he's overlapped the UVs for the insides of the arches, since they have the same AO.

    Usually environment assets don't have overlapping UVs for the lightmap or AO map, but it's always good to exploit repeatable lighting when you can.
  • Ruz
    Offline / Send Message
    Ruz polycount lvl 666
    standard.fx has an AO slot and enables you to choose uv channels
  • Mark Dygert
    Don't forget you can edit/remove the channels on an object by going to Edit > Channel Info. There are several channels that are used by 3dsmax but the UV's start at 1, 2, 3 ect and are maked by UV in the name.
  • maltuna
    I am trying to bake lighting into a small terrain with a shadow map. The base is a tileable texture that I pelt mapped across the terrain. I made a second set of uvs, and scaled it down so it all fits in the uv region, and want to make a shadow map out of this. How would I go about setting this up after I render out a shadow map from RTT in max?
  • Mark Dygert
    It depends on what version of 3dsmax you have and what type of shaders you can run. If you're using 3dsmax 2009 you can use the new composite map (metal ray material) and set the layer to multiply like you would in PhotoShop.
  • maltuna
    Thanks Vig! I now remember watching an autodesk features video on composite materials, but I totally forgot them. Works perfect. :thumbup:
  • Jeremy Lindstrom
    Offline / Send Message
    Jeremy Lindstrom polycounter lvl 18
    really? Got a link by any chance? I messed with the composite today but couldn't figure out how to use em.
  • AnimeAngel
    Vig wrote: »
    It depends on what version of 3dsmax you have and what type of shaders you can run. If you're using 3dsmax 2009 you can use the new composite map (metal ray material) and set the layer to multiply like you would in PhotoShop.

    Ya the composite map works great, I was just playing with that the other day and will be using it alot in the future.
  • maltuna
  • A-Train
    Offline / Send Message
    A-Train polycounter lvl 15
    Hey guys, I noticed that Composite Map is in 3ds Max 9 as well.
    Has anyone tried it for that version? I'll give it a shot, see if it works (hopefully it does) I also watched the video tut, very nice info indeed! Thanks.
  • Mark Dygert
    The composite material was updated in 2008-09. 3dsmax 9's version is fairly old and clunky but I think it might get the job done. I think the biggest difference is in the blending modes, the new version works like photoshop's layer blending modes.
  • A-Train
    Offline / Send Message
    A-Train polycounter lvl 15
    Vig: I don't mind too much about being able to blend different textures, but if I had 2009 I think i'd use the feature for sure!

    I am concerned about max 9's ability to do the AO in the 2nd uv method well. Guess i'll have to try and find out!

    It's actually a little new to me, i'm used to projecting the AO from a high sculpt to low (or at my old job I used to bake AO vertex maps directly on to the geo the old skool way). I do have a huge use for this technique though. I'll have to give the shader Eric posted a try. I mainly want to bake out small AO maps like Earthquake did for his bridge (he looks like he's using maybe a 128 from what I can see). This method is awesome sauce, i'm working on a scene with some tiling textures that will definitely look better once I get this down! Thanks :)

    Update: Anyone done the AO method with 3ds Max 9? What shader worked well for you...hehe sorry had to ask (If it cuts time down tinkering, then awesome).
  • Eric Chadwick
    Composite map in Max 9 doesn't do Multiply blend mode (try this instead), plus you can't get any Standard material to display 2 UVs at a time in the viewport. Only with a FX material can Max display 2 UVs at once.
  • Mark Dygert
    Yep it will work fine in 3dsmax9 as far as the baking goes, its only the composite material that might not work. Oh and I guess the viewport shader =/

    There are a few ways to render out AO.
    Mental Ray AO:
    If you set your render engine (Render Setup > Assign Renderer) to Mental Ray. In the Render to texture dialog (0) it will show up as a map output type.

    Skylight:
    - You can also avoid Mental Ray by setting up a sky light or a light dome.
    - There's a great script for that called Elight Dome http://home.wanadoo.nl/r.j.o/skyraider/e-light.htm It's not for commercial use but it does a great job. What it creates isn't hard to reproduce on your own if you ever have to use something like that on a commeical project.
    - Then apply a white or grey texture to your objects and in RTT render out a diffuse map.
  • A-Train
    Offline / Send Message
    A-Train polycounter lvl 15
    Eric, you are the king of awesome man! Thanks :D

    I have a large scene, and I've been looking at it, trying to figure out what's the best approach. I think that baking the entire scene would give a more believable AO. I have quite a ton of parts to unwrap. For assets that already have an AO (baked from the high sculpt and in are now in the diffuse) I'm assuming I should leave them out of the new "entire scene" AO that I am now creating.
  • Microneezia
    Offline / Send Message
    Microneezia polycounter lvl 10
    Usually environment assets don't have overlapping UVs for the lightmap or AO map, but it's always good to exploit repeatable lighting when you can.


    I have been creating a diffuse map with many overlapping UV's for a house. I then repeatedly render out the UV over and over to reveal the overlapping faces. I take those faces and move them around by 1.0 units until each face has a unique space over the infinite tiling. This is how I have been creating my AO bakes. However each of these faces will share the same AO bake that the face in the original 0-1 UV space has. This I assume is what you mean by the quote above.

    From what you say this is not how environments are typically created? With environment UV creation, is it typical to give each face in the scene its own UV space in the 0-1 square so that you do not overlap AO baking? Or am I misinterpreting you?
  • Eric Chadwick
    @A-Train: Makes sense. Usually in a game, all static level meshes use the same lightmap (or set of lightmaps), and dynamic/movable objects use their own lightmaps. Combining them together makes sense whenever the shaders are the same between entities.
  • Eric Chadwick
    @Microneezia: like EarthQuake's bridge example, it makes sense to re-use the same portion of a lightmap if that part of the model has the same lighting as another part.

    But most lighting situations call for different lighting, because of different bounce colors, or different occlusion, or whatever. So that means every triangle on the level geometry has its own little unshared chunk within the 0-1 UV space.

    Because the resolution really sucks when everything is packed into one lightmap, giving you blurry jagged shadows, games often break up a level into a number of lightmaps. But the less maps the better, because memory is limited and loading new textures into memory is slow.
  • A-Train
    Offline / Send Message
    A-Train polycounter lvl 15
    @EricChadwick: Big problem that I just realized after dumbly attaching all objects together. In 3ds Max 9 you have to attach all geo together in order to unwrap them...unlike 2008/09 from what I understand, you can select multiple geo and put a UV Unwrap modifier on them all, and unwrap them all in one UV space as if they were one object.

    That is a very effective way to do what I want to do, and therfore an easy pipeline into getting the desired AO result on a 2nd channel. Unfortunately i'm dealing with version 9 (if I attach all geo together and map an AO on a 2nd channel...well problem is they all have unwraps on the 1st channel as individual objects), so i'm going to have to figure out a work around. I'm now thinking I'll have to go through every geo one at a time and unwrap them all quickly.

    Then i'm really hoping that this method: http://www.game-artist.net/forums/vbarticles.php?do=article&articleid=37 can be used on multiple geo at once. As I want all of the objects to have light calculated on them to give shadow to the entire scene.

    Any ideas?

    I'm still guessing that I should leave all objects that already have an AO baked from a high sculpt out of the Lightmap AO texture plate (as they would get double the shadow and look hideous... hehe).
  • Eric Chadwick
    Most games use their own light-baking tool (or a 3rd party standalone tool) that creates the lightmap UVs automatically, so you don't have to run through Max's UV hoops.

    Someone talked about a method for just this issue not long ago, IIRC. A search might find it.
  • A-Train
    Offline / Send Message
    A-Train polycounter lvl 15
    If I search through the threads, do you remember any keywords that were in the post.
    I'm guessing IIRC's a person. Will do :)

    I think i've figured out the problem in my head thanks to your post "Combining them together makes sense whenever the shaders are the same between entities."

    I just have to ensure all geo are housed under the same shader. I had them under different shaders due to my viewport being way too slow due to normal maps/direct x shading being on (e.g: I had a regular ball and a normal ball for testing to see if things looked good in the scene). Now i'll put them all under one shader and I should be able to work it out...I wish I was using 2009. I may be upgrading sooner than later!
  • Microneezia
    Offline / Send Message
    Microneezia polycounter lvl 10
    That makes a lot of sense, thank you. One follow up question please...

    Because of the difference between creating diffuse and lightmaps, is it really common to use different channels entirely for the lightmaps and the diffuse maps?

    Or is it that generally in the industry once the lightmap UV's are created the same UV's are used to create diffuse (does this ever happen?). I realise its most likely subjective more than anything, but im trying to find the typical workflow so I can continue to put myself through a common pipeline as much asa possible.
  • Microneezia
    Offline / Send Message
    Microneezia polycounter lvl 10
    I guess my question was just answered 2 posts down .. :)
  • A-Train
    Offline / Send Message
    A-Train polycounter lvl 15
    Microneezia: Typically the reason why you want to have the AO on the 2nd channel is that you can quickly "Flatten map" all of the uvs for the particular geo that you are working on then using "Pack Uvs" you may quickly place them within the 1-0 UV plate espace. It isn't as sensitive as when you are unwrapping for a diffuse (normal/spec included in that channel) i.e: You would want to accomodate/and tweak as much texture space on your UV plate for specific areas of the geo. Ensuring the normal maps will be baked properly (retaining the details from the high sculpt is another example).
  • Microneezia
    Offline / Send Message
    Microneezia polycounter lvl 10
    I use max 9 as well, couldnt we just go >mapping>flatten mapping> as a tool to get quick lightmaps? is this used often?
  • Microneezia
    Offline / Send Message
    Microneezia polycounter lvl 10
  • A-Train
    Offline / Send Message
    A-Train polycounter lvl 15
    Now if only we could only find a script for Max 9 that you can UV Unwrap on multiple geos. I'd be a happy man :)

    Microneezia: I'm digging the house on your portfolio site, nice job! Are you going about texturing it as well? Just wondering, wouldn't mind seeing that.
  • Eric Chadwick
    Characters are typically mapped entirely within the 0-1 UV space, because of this you don't need to use a separate UV for the AO, you typically just blend the AO right down into the diffuse map itself.

    Environments typically use tiled UVs, so you can't simply combine the AO down into the diffuse. Also characters don't use lightmaps (baked shadows, bounce light, etc.) but environments do use lightmaps, so that's where the second UV set comes into play. BTW, IIRC means if I recall correctly.
  • Eric Chadwick
    As for scripts, check out Olivier Vandecasteele's page...
    http://users.skynet.be/arketip/arketipToolboxENG.htm
    Two scripts there, the Multi-unwrap and the Pixelpack one.
  • A-Train
    Offline / Send Message
    A-Train polycounter lvl 15
    Vig, thanks for the help man. For some reason I didn't see this post until now. I'm familiar with Render to Texture method, just the 2nd channel AO lightmap is new to me :) I'll give that skylight a try.

    EricChadwick: Question about http://maxplugins.de/max9_32.php?search=blendmodes&sort=Author I put it in the Max plugins folder C\Program Files\Autodesk\3ds Max 9

    I can't seem to find it in Max (not appearing at the top bar like the rest of my plugins, like EPHERE Utilities and the like). Quite strange indeed.

    WOOT! There is a multi-unwrap :D Thank you Eric.

    PS PixelPack looks like multiObjectsUnwrap on god mode
  • Eric Chadwick
    Have to restart Max, then the plugin will load. It is a map type, so look for it in the same place you would find Bitmap or Checker, in the slot of a material.
  • Microneezia
    Offline / Send Message
    Microneezia polycounter lvl 10
    A-train: check this, its helped me for a bunch of script installs,

    http://www.scriptspot.com/3ds-max/tutorials/script-installation-in-3ds-max

    im texturing the house now as we speak, im just re-UVing the thing properly, Ive been blocking out an Unearthly Challenge entry lately so Ive left my texturing on the back burner, Liquid D. asked me to texture the house though, so I dropped the UC for a couple days, tomorrow evening you should see the full house textured if you look back at my site... thats what I told Liquid anyway.

    thanks for your help.
  • A-Train
    Offline / Send Message
    A-Train polycounter lvl 15
    Sweet thanks guys, yeah my bad. Oh hells ya, I always restart Max! I just thought it was a script that would pop up on the top of the screen.

    Oh here's an archive I happened to find from a google search (just happens to be polycount...wonder why, hehehe)

    http://boards.polycount.net/archive/index.php/t-34439.html

    looks like some oldies but goodies. I definitely got PSD Path Unwrapper, but I think I still need to get textporter.

    I'm taking the first night off in weeks of solid working. Getting back to the grind first thing tomorrow! This threads been plenty of help.
  • Eric Chadwick
    Instead of that link, which is Print mode so you won't see any images, go to the Technical Talk section and browse the stickies, where you'll find that thread and many more.
  • Microneezia
    Offline / Send Message
    Microneezia polycounter lvl 10
    another follow up question... if I have my lightmap on a separate channel from my diffuse, and simply use a tool, or "flatten mapping/pack uvs" to instantly generate the AO/lightmap, then I cant multiply my lightmap onto my diffuse texture in photoshop. Since you dont usually move all faces by 1 unit and/or share UV space for lightmaps, I wonder how typically the multiplication of the diffuse and teh AO bake happens for environments.

    Perhaps if you have a seperate channel for the lightmap (with the flattened auto UV's) and a seperate channel for the diffuse (with many faces welded and sharing the same spot) you RTT a diffuse map?, and that would combine the 2 maps into one single map?

    Is that what is typically done? Is the AO map commonly a seperate map all the way through? Cause I still dont see how I can manipulate the AO map in photoshop on a seperate layer from my diffuse if the AO is not sharing space and the diffuse is. Perhaps multiplying the AO onto the diff in photoshop is mainly a character thing?
  • Eric Chadwick
    http://boards.polycount.net/showpost.php?p=856912&postcount=34
    For characters/weapons, typically the lightmap is merged down into the diffuse map. For environments typically the lightmap is a separate bitmap, using its own separate UV.
  • A-Train
    Offline / Send Message
    A-Train polycounter lvl 15
    Microneezia you can still bake out an AO map and have it overlap the diffuse in photoshop for "key assets" for your scenes. You basically model a high sculpted model and a low, and use the projection modifier & RTT to bake out the high detail to a texture.

    As the AO map isn't taking up a separate map, it's not necessarily taking up extra memory. It also makes your diffuse look a lot more detailed! Again this is for key assets that won't tile, as others have stated earlier that for Environment work you usually wouldn't use this method. Instead you would use the 2nd UV channel and have a seperate AO map.

    It depends on the studios pipeline, but I feel that future pipelines (by seeing some of the newer games like Gears of War 2) will have their own in house solution to deal with real time AO.

    Perhaps look into using Earth Quakes tutorial which EricChadwick already posted below.
    (link to EQ's tutorial is 9 posts down) to make yourself an AO on a per asset basis using Xnormal (by polycount member jogshy).
  • SHEPEIRO
    Offline / Send Message
    SHEPEIRO polycounter lvl 17
    there are different scales of AO detail, small details on an environment prop and tiled textures can be baked into the diffuse, larger scale lighting from object to object will be baked into a lightmap, using both of these on all objects/maps gives a very consistant soloution.

    T-train- you can bake AO into tiling maps/objects diffusemap, but only bake in per object lighting.

    Im also pretty sure that games like GOW2 will be using lightmaps, they will just be using them in fancy ways, along with other info baked into the scene. real time effect, but baked information

    something like this probably but on a scene scale
    http://www.valvesoftware.com/publications/2007/SIGGRAPH2007_EfficientSelfShadowedRadiosityNormalMapping.pdf
  • A-Train
    Offline / Send Message
    A-Train polycounter lvl 15
    Composite map in Max 9 doesn't do Multiply blend mode (try this instead), plus you can't get any Standard material to display 2 UVs at a time in the viewport. Only with a FX material can Max display 2 UVs at once.

    Hey Eric or anyone, I thought I'd do a quick test with StandardFX.fx shaders. I must say they are way better than the "DX Display using standard material" that i've been using in the past on games.

    I've run into a problem though, it seems that the diffuse, spec, & normal show up just fine in viewport but my AO on a 2nd channel doesn't show how it's supposed to. It doesn't matter what channel I change it to (2 or 3) with different mapping...it just appears as channel 1's mapping.

    A big problem, as I need to have my AO Lightmap in the 2nd channel for the entire scene... any ideas?

    I googled the problem, and found someone else who seems to have it too.
    http://discussion.autodesk.com/forums/thread.jspa?threadID=538188

    I'm using 3ds Max 9...i'm wondering if that's the problem?? I need to solve this...real soon :)

    I received a msg from Ruz, and he was real helpful. Apparently it works just fine in Max 2008...so It's time for an upgrade.
  • Eric Chadwick
    It's the StandardFX shader that's at fault. Use this Free FX shader for 3dsmax viewport , just make sure you fill all your unused map slots with blank bitmaps. Use a white or a black DDS file, depending on the slot, and if no normalmap then use a flat blue DDS there, rgb color (127,127,255). I tested this in Max 9, works great.
  • A-Train
    Offline / Send Message
    A-Train polycounter lvl 15
    Eric, awesome thanks! Yeah RTShaders is amazing.

    I upgraded to 2009 though, and it fixed the weird problem with standardfx.
    I can actually see the AO map moving around in the viewport (like a slippery ghost) when I move uvs in the editor on channel 2. It's pretty cool.
Sign In or Register to comment.