Mon, Dec 2, 5:42 PM CST

Renderosity Forums / Poser - OFFICIAL



Welcome to the Poser - OFFICIAL Forum

Forum Coordinators: RedPhantom

Poser - OFFICIAL F.A.Q (Last Updated: 2024 Dec 02 5:01 am)



Subject: setting light shadow parameter problem...


dennisharoldsen ( ) posted Mon, 28 January 2008 at 7:52 PM · edited Mon, 02 December 2024 at 5:22 PM

i set the light shadow parameter to .75 and get inconsistent results when rotating the character. i am way over my head here being a newbie and all. please help me.

see the problem: www.bestlogic.com/collage/pics/2008-01-28-17-14-09-PST.jpg

background:

i am using poser to generate clip art for a kids' graphics program i am developing. i am doing simple things at this point and hope to progress as i learn more about poser. i make scenes with a single character or prop and render them in 14 rotations using a python script. these then become components to assemble into a scene in my program called collage.

the rotations i am using are: 0,10,25,45,90,135,160,180,200,225,270,315,335,350 with and without shadow. this allows each character or prop to be displayed according to what the user wants to show. it is showing promise as a fun thing for kids to do giving some of the realism that poser provides along with its excellent png backgroundless images.

details:

i am using an infinite light overhead, slightly to the left that has shadow enabled and two lights in the front to fill in, that do not generate shadows. this is working pretty good except i wanted a more subtle shadow. i set the shadow to .75 but it gives a lighter shade for some of the rotations. it also varies according to the subject as you can see. the lights and camera are fixed and only the character moves.

i thought perhaps that poser was resetting the parameter as poser has been known to do, so i set the light shadow parameter after each rotation before the render. i don't understand why the variance seems to be random but then my understanding of lighting and rendering is minimal. without setting the shadow parameter, all the shadows are consistent but too dark for my taste.

i might be missing something major here about lighting, shadows, etc. i would appreciate any guidance or ideas of things to try. i want to keep the complexity and rendertime down since i am rendering a large amount of images. i am not tied to the method i tried.

thanks for any help and ask me questions if i left out any details.

 


bagginsbill ( ) posted Mon, 28 January 2008 at 8:27 PM · edited Mon, 28 January 2008 at 8:27 PM

I assume you're using the ground plane in "shadow catch only" mode?

That would explain why you thought it was too dark. If you were actually rendering the ground using a normal shader, the other fill lights would lighten the shadow. But in shadow catch mode, there is no lighting of the ground, only an increase in its opacity due to a shadow falling on it. I'm not sure how the shadow catcher was implemented, but I wouldn't be surprised if trying to use a reduced shadow strength is exposing a flaw in the algorithm.

Before we pursue that, you should do a test render with the ground having a normal shader, not a shadow catch only shader. We should be able to confirm that your shadows are always the same. If not, then there is something wrong with the light and using a new shader won't help. If, however, the normal shadow shows up consistently, then I can show you how to use that in a shader to control background transparency and get the shadow to do what you want.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


replicand ( ) posted Mon, 28 January 2008 at 8:33 PM

Pretty racy character for kids, eh?

 I would change the camera rotation rather than change the character / prop rotation. In theory this would keep your shadow parameters consistent. BUT when the camera is behind the character, the illumination would be pretty dark depending or the direction and type of lights you're using, so I'd probably use IBL or (an array of point lights spaced evenly throughout the scene) for fill lighting, no shadow casting or AO, no image - just constant color, set to whatever your fill lights currently are 


dennisharoldsen ( ) posted Mon, 28 January 2008 at 11:14 PM

thanks bagginsbill, i really appreciate your help and insight.

to tell the truth, i heard the term "shadow catch" for the first time about 2 weeks ago. of the poser subjects i know of, i understand nearly nothing and i am frequently learning of new subjects about poser that i have never heard of before. what a challenge.

i have seen some of the posts you have written and they are very impressive. i intend to go through them when i get to the point that i can understand them. for the present, i am trying to get my overall project in basic working order. it involves many things of which poser is an important part.

i recently started peeking into the material room to see what was there. i have tried to get an idea about shaders and it seems vast. i didn't know the ground was in the material room and sure enough, it was set to shadow catch only. i unchecked it and my shadows are consistent. however, i no longer have transparent backgrounds but i think you said that can be dealt with.

at this point, it doesn't have to be perfect, because i can always re-render the scene library which was what i was doing to improve the shadows. i don't know how to use python to do shader stuff yet but i can always do a global change to the pz3 files if nothing else.

my major goal right now is to add more content. here are examples of what the images in the collage (online) library are like at present in terms of transparency:

www.bestlogic.com/collage/pics/actors-phoebe--phoebe-02-wait_s=1_v=n_m=0_r010.png
www.bestlogic.com/collage/pics/machines-vehicles_fullsize--36AM_s=1_v=0_m=n_r025.png

i am looking forward to hearing what is possible next with shadows.


dennisharoldsen ( ) posted Mon, 28 January 2008 at 11:16 PM

replicand: thanks for the suggestions.

i am hoping to experiment with lights. the main thing is getting an idea of what to pursue when you're new at something and you have provided some things to explore.

you said: "Pretty racy character for kids"..

during software testing, i have to explore all options for a complete evaluation.

here are some pics produced by collage that are along the line of what i think kids might do or like to see. but i didn't say that all users would be little kids. big kids are allowed too but they might have to provide their own content if they have special needs. however, it is my intention to provide only content suitable for kids or families.

www.bestlogic.com/collage/pics/2007-12-23-19-02-18-PST.jpg
www.bestlogic.com/collage/pics/2008-01-08-03-16-12-PST.jpg
www.bestlogic.com/collage/pics/2008-01-15-07-17-04-PST.jpg
www.bestlogic.com/collage/pics/2008-01-17-00-02-17-PST.jpg
www.bestlogic.com/collage/pics/2008-01-18-02-32-57-PST.jpg
www.bestlogic.com/collage/pics/2008-01-22-00-51-25-PST.jpg
www.bestlogic.com/collage/pics/2008-01-26-22-07-03-PST.jpg
www.bestlogic.com/collage/pics/collage-at-work.jpg


bagginsbill ( ) posted Tue, 29 January 2008 at 4:41 PM

Attached Link: My Shadow Catcher

file_398754.png

OK try this. Follow the link to another thread. I posted a material there, shadowcatcher.mt5. I can't load files with that extension to the forums, so I added .txt to the end. You have to remove that from the filename when you download it.

The material was designed to do a controlled color shadow catcher, where you are rendering with a background photo, and you want to make your rendered shadows look like the ones in the photo.

You, of course, will NOT be rendering with a background. So it will work a little differently, but I've tested it and it still works.

Load that material on your ground.

My instructions here won't make sense to you until you look at that shader and the instructions in the other thread.

Follow the calibration instructions, so that your ground renders black and white, with a good strong white where the shadow falls. Calibration is so the shader can learn what your light and shadow levels actually are. Once you calibrate, you won't have to do that again, unless you change your lights in any way. But for what you're doing, I imagine you're always using the same lighting.

After you get it calibrated, then turn off Calibrate (set it to 0).

The remaining instructions in that thread had to do with matching lit and shadow colors against a specific background photo. You're not doing that.

To adjust it for your purpose, put WHITE in the Lit color, BLACK in the shadow color. Adjust the Blending Factor between .2 and .4.

Configure your Poser background so you render over black. When you render, you will not see the shadow but its there. Render, and save as PNG. Load it onto any background, or just drag the PNG file into a browser to see it, and the shadow should compose nicely.

Its important to make good cutouts that you render over black. I don't mean that you have a black object behind - just render with background configured to black.

Using Blending_Factor = .3, I got this cutout you see here.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


dennisharoldsen ( ) posted Tue, 29 January 2008 at 4:55 PM

thank you!

i appreciate that you would share what has obviously taken much time and effort to learn and i know that i am not the only one that feels that way.

i am stopped on rendering right now, so it is my first priority to understand the material you've provided and i look forward to learning something in a new area.

for me, it's nice to have something specific to work on when learning new things instead of just the overwhelming mass of information available. at least i find that to be true in programming. 


dennisharoldsen ( ) posted Tue, 29 January 2008 at 9:44 PM

bagginsbill: it worked!

your instructions were very clear. thank you.

i have a couple of details to work out. rendering over black puts black into the hidden channel. i have had great difficulty processing png's and most graphics programs don't do that well. i have my own graphics library but i don't know how to do png's. i found a utility that crops the images in batch mode. the only thing that works well for making thumbnails for menus is easythumbs, but it reveals the hidden channel so that the thumbnails have a black background. i was able to render over the light-gray i use and i tried white, but the shadow has a blue cast to it. i can live with the black background. it's not a show stopper.

the other thing i am working on is converting the 1000+ pz3 files i have. i pretty well have that worked out. being a lazy programmer, i always like to get the computer to do it while i sleep.

i was worried that the render time might increase. i haven't timed it but it appears that there is little or no difference.

this has been a great success and without your help, i would never have guessed what to do or even how to begin. again, thank you.

you said in the other post that "we build business rules calculations using nodes". that's something i have never heard of. my career has mostly involved business apps. it would be interesting to know more about that and what your educational background is.
 


dennisharoldsen ( ) posted Wed, 30 January 2008 at 7:41 AM

the shadows are now consistent, the technology is incorporated in my rendering script and with some tweaking, i was able to render over the background and get gray in my thumbnails. the best part is that what i have seen has opened up some new possibilities.

www.bestlogic.com/collage/pics/2008-01-30-02-22-42-PST.jpg
www.bestlogic.com/collage/pics/2008-01-30-05-27-09-PST.jpg


bagginsbill ( ) posted Wed, 30 January 2008 at 5:30 PM

Cool - glad it worked.

Regarding rendering on black...

For pixels that are completely filled or unfilled, this is not an issue. It either is 0% of your render in it or 100% of your rendered pixel in it.

But what about fringe pixels - pixels that are only partially filled by your 3D content? Poser figures out what percentage is filled, and puts that in for the alpha value. But it also writes a color in the color channel. In doing so, it will pre-blend your currently configured background color with the 3D color for that pixel.

If you render against white (RGB 255,255,255), and the pixel is of a blue object (RGB 0,0,255), and the 3d object only fills 50% of the pixel, Poser will record RGB(127, 127, 255) in that pixel of the color map. When you finally compose that with your background image, the math comes out wrong. You end up with a gray fringe around your cutout.

You can see an example of this mistake HERE

That is why you must render with BLACK. Black is RGB 0 0 0 and means that only the true color of your 3D object is recorded.

This is called a pre-multiplied color channel. I'm not sure if you're writing your own code to do the compositing, or you're using some other code. I don't remember the details of the WIN32 API but I've done this before. You need to tell Windows that you have a ALPHA_PRE_MULT type of image. (Again, I can't remember the exact name of the flag.)

If you correctly set the flag, then when you DrawBitmapAlpha (or whatever the function is called) it does the right thing.

Mathematically, given B for your background photo pixel, and F for your foreground (rendered) pixel, and A as the Alpha (opacity) value, compositing is done like this:

(1 - A) * B + A * F

That is the generalized blending or interpolation formula.

But the PRE_MULTIPLIED version is simpler because A * F has already been written into the PNG file. So the correct blending formula is:

(1 - A) * B + F

Windows will choose the second form if you correctly tell it that your color channel is pre-multiplied. Note that this is faster, too, because there is only 1 multiply, not 2.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


bagginsbill ( ) posted Wed, 30 January 2008 at 5:33 PM

To make good thumbnails in your software, you should composite your cutout on any color background you want (probably white), using the correct blending algorithm (pre-mult) and then resize it. The resulting non-alpha image should look good everywhere.


Renderosity forum reply notifications are wonky. If I read a follow-up in a thread, but I don't myself reply, then notifications no longer happen AT ALL on that thread. So if I seem to be ignoring a question, that's why. (Updated September 23, 2019)


dennisharoldsen ( ) posted Thu, 31 January 2008 at 8:28 AM

thanks for all the information. i think for now i am set to go. when i get my entire system together as a beta, i will be in a better position to tweak the lighting, render settings, etc.

i was looking at the "shadowcatcher" you developed. it looks like an interesting way to do things. having something that has meaning to me to dissect seems like a good starting point. the poser documentation doesn't seem too clear. i hadn't heard of it outside of poser. what is the general technology called if i want to get more information?

you were talking about methods of compositing. i gave links to collage images that are a composite of poser pngs over a jpeg background. how do they seem? i am not an artist. i have developed a number of technical routines for graphics that i use. collage uses an entirely different way that avoids much of the technical stuff. i do have the capability of doing thumbnails but i was trying to use easythumbs because it works, it's free and if i distribute the development part of my system, i don't have to deal with packaging, documentation, and answering questions. for trimming the pngs files, i am using a very efficient utility that has a command line interface. i am semi-retired and not up for developing a png routine from scratch.

i was noticing a rendering artifact in my testing. it has nothing to do with this thread but you might want to take a look anyway. you will notice that the utility i am using to crop the images is having a problem with the black background even though i set the threshold up a bit.

www.bestlogic.com/collage/pics/2008-01-31-00-15-29-PST.jpg

your help has been very valuable. i am looking forward to studying all the stuff you have shared on the forum. i also need to look at other 3d programs. i have beginner copies of vue and carrara and i have fooled around with others in the past.


Privacy Notice

This site uses cookies to deliver the best experience. Our own cookies make user accounts and other features possible. Third-party cookies are used to display relevant ads and to analyze how Renderosity is used. By using our site, you acknowledge that you have read and understood our Terms of Service, including our Cookie Policy and our Privacy Policy.