WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   Adding lightmap and bumpmap (https://forum.worldviz.com/showthread.php?t=5933)

stakkie 01-09-2017 01:53 PM

Adding lightmap and bumpmap
 
Hello,
I'm trying to add a light map and a bump map from 3ds Max into Vizard by using osgb. My light map is not displayed in vizard, but it is included as a texture. If i am using a complete map it is working, but then the resolution is not very good. Can anyone help me?
Thanks in advance

Jeff 01-09-2017 05:59 PM

What do you have set for the target map slot? Can you attach screenshots of the OSG export settings?

stakkie 01-10-2017 09:36 AM

1 Attachment(s)
The target map slot for my lighting map is self-illumination.

Veleno 01-13-2017 10:30 AM

Hi Stakkie,
To fully take advantage of shaders (to use the modern workflow diffuse/spec/normals/etc.) you'll want to be using the vizfx workflow. For this workflow, the lightmap should go in the Ambient slot. The Self-Illumination slot is currently used for glow maps.

Check out this reference to see what is supported:
http://docs.worldviz.com/vizard/Shaders_3DS_Max.htm

For the programming side of things, the main difference is adding a model with vizfx.addChild('model.osgb') instead of using viz.add('model.osgb').

The old workflow is mainly useful when performance is considered more important than aesthetics, such as with unoptimized multi-million polygon architecture models.

stakkie 01-13-2017 10:52 AM

Thanks for your comment, I'll try that!!

stakkie 01-13-2017 11:17 AM

2 Attachment(s)
Hi Veleno,
Now my diffuse color is not showed in vizard anymore.
What am I doing wrong?

I also added my Slate Material Editor printscreen of 3DS Max, maybe that gives a more clear view of what i did (wrong).

Veleno 01-13-2017 12:49 PM

Exposure Sample Script
 
1 Attachment(s)
Nothing wrong with your setup - your scene is just over exposed. The default exposure looks something like Diffuse * (Lightmap * 2), where lightmap values are interpreted on a 0 to 1 scale (e.g. 255 in photoshop reads as 1.0 to Vizard). This means that a neutral exposure is 50% gray.

As long as none of your brights are clipped in your lightmap you shouldn't need to rebake - exposure can be adjusted in Vizard by using a post process shader, like this:

Code:

import viz
import vizfx

viz.go()
vizfx.addChild('Exposure Test.OSGB')

# Disable the default light (directional light attached to user viewpoint).
# This should be done as soon as your scene has it's intended light added in.
viz.MainView.getHeadLight().disable()

# Import vizfx's post process functions,
# then specifically grab the ones for color adjustment.
import vizfx.postprocess
from vizfx.postprocess.color import ExposureEffect

# Create a new Exposure effect. In this case I'm darkening by 3 f-stops.
# If you aren't familiar with camera terms, going down by one f-stop
# halves the current brightness, while going up doubles it.
effect = ExposureEffect(-3)

# Add the effect to the post process manager
vizfx.postprocess.addEffect(effect)

# Important: set the pixel format to 32 bit.
# This prevents banding after re-exposure and prevents bright whites from being clipped.
# Exposure will not work as expected with overexposed scenes without this line.
vizfx.postprocess.getEffectManager().setPixelFormat(viz.TEX_RGB_32)

That should help you out. Please also note that inspector does not currently have a way to adjust exposure or add other post effects on its own. You may also want to disable Inspector's default sun node or disable realtime lighting on your model if it's making it difficult to accurately see what's going on in your model.

On a side note, lightmaps are treated as part of the lighting model in the vizfx shader so they are compatible with realtime lights.

I've attached a sample file that adjusts the exposure on a test model, and you can learn more about Vizard's built in post-process shaders here:
http://docs.worldviz.com/vizard/postprocess_color.htm

stakkie 01-13-2017 12:53 PM

Thanks!!! Now it looks very good :D

Veleno 01-13-2017 12:56 PM

No problem! Glad to help.

stakkie 01-25-2017 07:57 AM

Just two more questions.

What would be the workflow in 3ds max to get the right lightmaps? What would be the best way to change the brightness of the render-to-texture textures in 3ds max?

I tried to view my model on the htc vive. But if the line
Code:

vizfx.postprocess.getEffectManager().setPixelFormat(viz.TEX_RGB_32)
is added, the vive doesn't produce an image anymore. If I remove that line the post effects don't have the desired result. Is there a way to get this to work?

Veleno 01-25-2017 10:44 AM

> What would be the workflow in 3ds max to get the right lightmaps? What would be the best way to change the brightness of the render-to-texture textures in 3ds max?

The cleanest results come from rebaking, but that's way too slow for minor tweaks.

First of all, here's our internal workflow when baking:
  • Get the diffuse textures onto most objects
  • Set up initial lights
  • Do test renders to get a general feel and iterate on the lighting setup
  • Unwrap with Steamroller to UV channel 3. Steamroller is a short script I wrote a while back as an alternative to Render to Texture's auto UV unwrap because RTT's version always insists on grouping UVs by material ID which can waste a ton of space. It also provides quicker access to the function.
  • Make a folder for the bakes. I usually call it "bakes" and stick it in a subfolder of wherever the relevant max file is. This makes it so if I ever grab the project again from our backup system all the assets it depends on come with it. When baking on a render farm I also make sure the bake folder can is accessible by our local network.
  • Bake at low resolution and low quality for very fast bakes, then test out the LQ bake in the scene an iterate as necessary on lighting and initial exposure.
  • When satisfied with the way the lighting interacts with the textures, crank up the settings to your target quality and test them on one object. This may take a while.
  • If the quality seems sufficient on that object, bake the rest.
  • Bakes can take several hours, so consider letting it go overnight or over a weekend. Render farms help a ton, and at the minimum it's very helpful to be rendering on a different machine than your workstation so it doesn't tie up the processing power while you're trying to build more stuff. Render stations can be cheap because they don't require a fancy graphics card to work efficiently - a lot of renderers still don't let the GPU pitch in with the baking process.

Prior to using shader based exposure controls, we'd do minor exposure tweaks in photoshop. We'd make a copy of the baked folder (usually called "bake_mod") to keep the originals intact and run the whole thing though a Photoshop batch process. Anything more than that and you get the same kinds of artifacts you get from trying to do major exposure changes in 8-bit.

I'm going to look into the Vive problem and see if I can reproduce the issue.
  • I'd imagine you're on a fairly modern graphics card, but I'd double-check that the card you have supports 32-bit stuff.
  • Probably goes without saying as well, but make sure all the relevant drivers and software are up to date. I had a different shader issue with the Vive go away on it's own after an update.
  • For very minor adjustments you should be able to get away with exposure the default bit-depth. Dimming usually works better than making things brighter.
  • Since this is a major readjustment it's possible that you may be stuck having to rebake.
  • You can also try using 16-bit to see if that works: vizfx.postprocess.getEffectManager().setPixelForma t(viz.TEX_RGB_16)

Other notes: True GI is super slow to render cleanly, so most of the time I'll fake GI by setting VRayDirt as the intensity of a VRayAmbient Light and supplement it with appropriately placed point lights. If I'm planning to use realtime lights in the scene I'll also use the same approach to provide a base level of ambient light and.

Veleno 01-25-2017 12:19 PM

Bad news: I reproduced the problem and talked to our Vizard programmer and he believes that the Vive itself doesn't currently work with 32-bit, and at the time of this post there doesn't appear to be a quick one-line-of-code way to just briefly switch back to 8-bit just before sending the data to the headset.

8-bit exposure works, with the limitations stated above, but you may be stuck rebaking on this one.


All times are GMT -7. The time now is 05:18 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Copyright 2002-2018 WorldViz LLC