Clamp light intensity [0,1]. Combined lighting never light the texture above 1.

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Search this Thread Display Modes
Old 06 June 2013   #1
Question Clamp light intensity [0,1]. Combined lighting never light the texture above 1.

I'd like to create a shading network where there is a "maximum" illumination or brightness. My goal is that lights can be added to brighten the scene, but that the brightness of the objects never exceed the brightness of the texture.

Anyone know how I could do this?


Last edited by Funxer : 06 June 2013 at 06:19 PM.
Old 06 June 2013   #2
Use Linear Lighting Workflow (LWF) and an energy-conserving shader, such as the mia_material_x if you're using mental ray.
Commodore 64 @ 1MHz
1541 Floppy Drive

"Like stone we battle the wind... Beat down and strangle the rains..."
Old 06 June 2013   #3
Thanks, but still not working

I've added the gamma correct to my texture, applied a mia_exposure_simple node to the camera, and I'm using a mia_material_x... And I'm still getting light values above 1.

This is what I'd like to have:

However, this is what I'm getting from a render using the current shading network:
Attached Images
File Type: jpg cropped_clamp.jpg (42.2 KB, 49 views)
File Type: jpg cropped_notClamp.jpg (54.9 KB, 49 views)

Last edited by Funxer : 06 June 2013 at 10:17 PM.
Old 06 June 2013   #4
What's your Specular Balance? It should be at zero. At 1, it's using fake Phong/Blinn-style specularity. Not sure if that would play a part.

Are you using LWF?
Commodore 64 @ 1MHz
1541 Floppy Drive

"Like stone we battle the wind... Beat down and strangle the rains..."
Old 06 June 2013   #5
Specular Balance of 0.00 did not make a difference. Also I've attached a screenshot of my shading network.
Attached Images
File Type: jpg shaders.jpg (95.4 KB, 5 views)
Old 06 June 2013   #6
Create the following in the Hypershade or Node Editor...

* File Texture (this is the texture that you want to use)
* Surface Shader
* Clamp
* Surface Luminance

Plug the output from the Surface Luminance into the Clamp input.
Plug the file texture output into the Clamp maximum.
Plug the clamp output into the Surface Shader colour.

What this does is grabs the surface luminance from the lights and clamps the luminance according to a value you set via a texture.

Hope that's what your after.
Old 06 June 2013   #7
Thanks for the help! I had tried using a surfaceLuminance node with a clamp before, but it didn't work as I'd expected.. I guess the trick to make this work is using a surfaceShader.

I changed the network a bit from what you described because I was losing details of my Texture when plugging it into the clamp node. Instead I'm using a max value of 1 on the clamp and plug the texture and clamp into a layeredTexture (attached screenshot of network).

Another thing that I'd like is to keep the color from the lights. If I add color to the lighting, it doesn't through in the render. Any ideas how I can plug the color from the lighting back into the shader? I see in the documentation for the surfaceLuminance node that there are RGB components of the light intensity, but I can't figure out how to connect this as output.

Attached Images
File Type: jpg clampedShadingNetwork.jpg (96.3 KB, 43 views)

Last edited by Funxer : 06 June 2013 at 09:28 PM.
Old 06 June 2013   #8
I haven't tried this, but instead of a surface shader try using a lambert shader instead. I think that way you'd get the colour from the lights.
Old 06 June 2013   #9
When I use a lambert, the lighting is no longer clamped.

I'm back to this result:
Old 06 June 2013   #10
I think you were on the right track with the surface shader. I achieved what I believe should be the correct output doing the following, which I believe would only work with desired shading of mental ray materials (I used miamaterial_x).

Plug the "result" attribute of the MR shader into the input of a clamp node. Set the min and max on the clamp node to 0, and 1, naturally. Plug the output of the clamp node into the color for the surface shader, should work fine. I did this in 32 bit float so I could verify the values, which are indeed clamped to 1. I would assume it would work for other bit depths too.
Old 06 June 2013   #11
I tried the shading network you described, but I didn't get the results I was after, perhaps I misinterpreted your instructions. I was wondering if you could go into more detail? Thanks

For the record, the best results I've gotten so far were with a surfaceLuminance node plugged into a clamp and a surface shader.
As illustrated in this image:

I get the light intensity clamped nicely, The issue now is that the color of lights don't come through in the render.
Old 06 June 2013   #12
Sorry for not being able to help earlier, I think I misunderstood your problem.

But are you still rendering in mental ray, or in Maya's native renderer? If using MR, are you using point or spot lights, or directionals? Perhaps an area light would work, as the others have no area? Just an idea!

Or perhaps it's a render setting flag somewhere... I've not worked with surface shaders much, interesting network you've got going on here.
Commodore 64 @ 1MHz
1541 Floppy Drive

"Like stone we battle the wind... Beat down and strangle the rains..."
Old 06 June 2013   #13
You pm'ed me about this, but I like to post on the forums, because that way others with this issue can see this later on.

My shading network was really simple (I used the node editor to explicitly show the connections, you can just as easily do this in the hypershade/connection editor).
Attached Images
File Type: jpg Capture.JPG (74.5 KB, 11 views)
Old 06 June 2013   #14
Thread automatically closed

This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 10:55 AM.

Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.