several lightmaps/UVs for one object? (max)

Yet another mystery in the UV world for me, I’m afraid.

I have modeled an apartment and I’m trying to light map it. As I started working with the lightmaps of the walls (one object in Max), I realized that the resulting “pieces” are very tiny - there are a lot of polys and they get scattered on my 512x512 map (see screenshot).

Naturally this looks rather terrible in Unity, because there’s so few pixels on a huge wall.

Is there a way to have separate maps for separate polys without breaking the object? Or some other way to do this smartly. There’s really only 4 polygons that need high quality light maps and the rest 100 or so are not that important. But I would still like to keep the wall-object in one piece if that’s possible.

Thanks!

282394--10143--$walls1lightingmap_192.jpg

Continuing my experiments in order to have separate lightmaps for sub-objects, I made a little text box.

I followed one tutorial, which instructed having several Edit Mesh and UV Map modifiers stacked on the object, in order to assign different materials to different polys. Obviously a huge overkill for a simple box, but it’s just a test object.

So now this box imports nicely into Unity with all six sides having separate materials where I can slap the glorious textures. Great.

My goal however, was to get to do the same with light maps, but despite all these UVW Maps, I can’t figure out how to render the individual sides of the box on separate images from Render to texture - is it even possible?

On the mapping coordinates section it says something about sub-objects but it’s grayed out. Is that it and how do I enable it, or am I totally on the wrong track here? :?

All tips greatly appreciated.

282761--10163--$clipboard01_141.jpg
282761--10164--$modifiers_344.jpg
282761--10165--$cube_157.jpg

If you need a lightmap texture for each face you can either

  • detach the faces and render out each one individually to get the unique light map for each one. Recombine the objects into a single object afterwards and you are done

  • keep the one model intact but when you are using render to texture, select a face in the UV editor and change the W setting to a higher value than the rest. Repeat for each face. The W value will determine which face is on top of the stack, but remember that render to texture will overwrite the previously rendered light map if you forget to rename it

Thanks!

I just realized the firstly mentioned method myself while I was out for a jog. I should go out more :smile:

Don’t forget that the auto UV mapping is rather poor and it’s always best to do it by hand.

The other thing is that you can always scale the UV’s up for parts you want to have more pixels and scale down UV’s for areas that need little detail like areas that are always in shadow.

Also 512 is pretty small for a lightmap, especially for an environment. Unless you have hardware limitations going up to 1024 probably isn’t going to make much difference and give you 4x the pixels.

The image of your lightmap suggests that with a bit of tweaking by hand, probably about 2 minutes work you could almost double the pixels of your existing lightmap just reorganizing them into a square layout, perhaps packed closer together first and then scaling up so the square layout fits the square texture better.

You can also use stitch to stitch edges of floow and ceiling pieces together. Your auto unwrap seems to have seperated them by room. The floors at least, are most likely seamless and can probably all be stitched into much larger shapes with smaller UV shapes fitted around them.

I assume your rooms and corridors etc are not all square like the lightmap suggests. I saw a section of the floorplan in your other post :slight_smile: so I highly recommend doing some hand editing. Especially with 3dsmax, it has some really nice tools for this.

UV Mapping is definitely not one of my strong points :smile: In addition I just jumped from XSI to Max this year, so there is a lot to learn still. Thanks a ton for both of you for your tips, I feel like I have learned a lot in just a couple of days!

I managed to get this working somewhat, but there’s still lot to do quality-wise.

Here’s a couple of things:

  1. Should I use exposure control normally when rendering the lightingmap? I’m rendering in mental ray and using both FG and GI and it seems that I can make the map a little brighter by using lower-than-normal EV, but it gets blurrier (burns) the lower I go.

  2. The blurriness in general is my second question. In the screenshot I rendered the lightmaps separately for both walls visible, using 1024 for map size. For UVs, I just used the UVW Mapping modifier for now.
    In Unity I imported them as RGB 24 bit with 1024 for max size.
    I imported the shelves and the curtain rod to get a better idea of the shadows, but it’s not really very sharp yet.

  3. When using lightmaps, are you supposed to use Unity’s actual lights at all? I used a point light for the screenshot, because it was really dark with just the maps. But should I instead just have really bright maps?

In the screenshot, the other wall is supposed to be of a different color and there’s plenty of stuff throwing those shadows. There are nine halogens in the ceiling (not imported yet) and a couple of floor lamps on the sides of those shelves. So it’s not really populated yet, but I’m not crazy about the overall dirty/blurry look I’m getting so far.

I’m afraid there isn’t much you can do except learn UVmapping or bump up the texture res. It’s as simple as that really.

I think the max resolution you can use is 4096. But thats too high for older cards.

You can probably get double the resolution at the same res modifying the UV’s by hand. Otherwise you can do each room seperately and create a simple occlusion system. Eg. Have a trigger for each room that overlaps neighbouring rooms triggers. When the player triggers of collides with it render connecting rooms.

That way you can focus on each room individually and stream in rooms as you walk through the apartment.

In the end to get what you want to work is just going to require some more work :slight_smile:

I tend not to use FG and GI for my light/shadow map renders. Instead I use normal lighting as you have more control over the map and also render out an AO pass so that you can fake GI in a way that often looks more appealing (if less accurate) than GI

That’s not to say that there’s anything wrong with using FG and GI, it’s a personal preference really

Thanks for the tips!

I will try that fake GI out too. My goal here is to get as close as possible to the still renders I make from the same scene, using FG and GI, but of course that doesn’t have to be the setup for the light maps.

I also tried messing with the UVs. I don’t know if I’m doing it right, but I just pulled the vertices around the UV editor to maximize the area where the spotlight patterns are on the wall.

Of course the UV editor representation as well as the resulting light map looks very distorted and stretched, but I guess that ok(?).
However, when I compared that with the original version, there was very little difference in the accuracy.

I’m still working with just one wall to keep things simple :slight_smile:

About the dark result you got on unity and the point light:

If you propely baked the lighting on the texture, you often won’t want the diffuse component of realtime lights on your surface (specular effects and similar view-dependant effects are nice additions)

You should switch the shader you are using on the surface. I believe the default one is a pure “diffuse”, which is considering your lightmap as the color of the surface, and not the incoming light. You will want to take a look at the lightmapped shaders. Surface color is one thing, light is another.

Grossly:
observed color = diffuse color * incomming light (or lightmap)

So:
If any of them is Zero or very low, the observed color will be Zero or dark no matter how bright the other one is.
If you want to reproduce a full texture, the other should be 1. (1 * anything = anything)

Specular is added:
observed color = (diffuse color * incomming light) + specular

And from here, things go more creative. Get this before anything else. I yet wonder if I will ever understand the 3 vectors lightmaps people are getting from turtle render to interact better with the bump (if any other render bakes it). Not to mention, that spherical harmonics thingy. :shock:

To avoid distortion You have to change the UV’s before baking the lightmaps, and set the Texture baking to use existing UV’s instead of creating auto UV’s.

If you edit the UV’s after baking you are just stretching the UV’s and getting distortion. If AutoUV is still enabled then your custom UV’s will be overwritten.

Hi,

Thanks for the tips again - I feel like I may have been a bit unclear with the details:

  1. I am using lightmapped shaders. With the previous posts I was using lightmapped/diffuse and for this one I went with vertexlit, since that wall really just has a paint on it.

  2. About stretching the UVs - in the other screenshot, you see the shape of the map - so I made a basic unwrap for the wall and just pulled the ceiling-facing vertices up in the UV editor to fill up the square UV-space. I suppose this is ok, since it appears ok in the Unity screenshot, but does it give me any benefit? I suppose I could also further enhance the resolution by breaking the wall in the UV editor and giving more pixels for the areas where you see the light pattern, but this is not that bad and it’s only 512 in these shots.

Talking about UVs. Do you guys have experience with any of the plugins available for Max, like Unwrella? Are they worth the money? I feel like UVs are really one of my weakest qualities as 3D-guy :roll:

Screen shots:

  1. the lightmap as what gets saved on disk and what is displayed when Max renders it.

  2. shot from Unity.


284710--10215--$unity1_806.jpg

I believe you do realise that that the yellowish “main color” of the shader is still darkening it on your Unity scene, right?

But your image on the quicktime viewer (or the likes - I’m not familiar with apple) is very different too. Wouldn’t this imply that the gamma setting inside MAX is probably too off from your system?

You are right about the yellow color, it probably does darken the image, but it’s due the exposure control settings (mental ray) and specifically, the white balance.
I can set it to match the color of the lights so that the result is completely a “grayscale” image, but I’m not sure how “correct” that would be. I think, I tried that at some point and the result was pale, but not really much brighter.

The gamma of the light map should be at the regular 2.2. I try to stay in a linear workflow with textures and so forth, but in the renders the image gets tone-mapped and gamma-corrected by the exposure control.

I’m not sure, but I think the difference in the render display and the Quicktime viewer is because Max doesn’t show only the lightmap as it renders, but rather like a complete image with diffuse color as well and it then just saves the light information - I’m not sure about this.

Ok, I forgot that complete map thing when you pointed that the max display was different from what you get on disk. I thought that was a problem. Indeed it shows the complete map even if we save only the light layers.

About white balance, I believe it’s an artistic decision… if, for example, you want your incandescent lights to appear incandescent, grossly you wouldn’t want to balance what is white, as you said.

I’m not shure if we are trying to solve the same composition problem. Are you trying to deal with something like this:
http://forum.unity3d.com/viewtopic.php?p=292403#292403

On the matter of gamma and linear textures… man, I still don’t get it 100%. So many dos and don’ts.
I’ve put togheter a working workflow with Quest3D and Vray, now on Unity free I should learn it properly since I won’t be able to correct it for a while. (or can we?)

I’m sorry I couldn’t help you properly. Best luck.

Thanks for confirming that render view issue and thanks for the link!

I guess we are talking about a very related thing. Now that I read that thread and realized that the lightmap only makes the surface darker and not brighter, this is starting to make sense! I guess then the current solution is to use Unity’s lights to get the desired level of lighting and use the lightmaps to darken the parts that are supposed to be shadowed.

Yeah, white balance is at least partly artistic decision and I want to leave some color on the light - at least that’s how I do it with my still renders. In the very first post I had accidentally left the daylight setting of 6500K on, thus getting that very golden look, but in the latest screenshots it’s closer to the indoor light values, around 3500K.

I’m not sure if I understand linear workflow any better, but I guess the most important thing is to be consistent - de-gamma your textures and keep your hdr’s at 1.0. Usually the washed out look of double-gamma is pretty easy to spot.