PyPRP Discussion: Revised prp_MatClasses.py

If you feel like you're up to the challenge of building your own Ages in Blender or 3ds Max, this is the place for you!

PyPRP Discussion: Revised prp_MatClasses.py

Postby GPNMilano » Fri Apr 03, 2009 6:21 pm

This thread is to discuss the changes made to MatClasses in my branch so that it can be merged to the existing trunk and next release of PyPRP:

This is what was changed, and added:

Ambient Color This has been set to the MirColor in Blender. So Colors now work like this:

In blender Col controls the Material's in Uru color, Spec controls the Specular color and Mir controls the Ambient color in Uru.

This caused the biggest change in that the default setting when you create a new material in Blender is to set mir to 1.0 for Red Green and Blue. Since nearly all materials in Uru use a 0 for their ambient colors except for certain things (lamp flares, certain layer animations etc) Having it export with a 1 will negate any vertex coloring. So to set this right all new materials in blender will need to have their mir setting set to black rather than white so that vertex coloring will still show through.

Ambient Color Animations:


Since Mir color animations are not implemented yet in Blender, I mapped this to the Color panel located in the MapTo section in blender. So to create a layer animation that animates the layers ambient color, in the materials section you set the color selector in the mapto section (the default being purple) to the color you want to start the animation at. Then press I and select AllMapping, this will allow you to animate this color. You then go to your end frame, chose your color and repeat the process. Once done in the IPO curve editor window you can delete all the other IPO curves if you so choose except for texR, texG and texB (this isn't necessary but helpful)

Flags

Most flags are individually set now to their own mapto buttons in no particular order:

LIGHTEN = kBlendAdd
SUBTRACT = kBlendSubtract
SCREEN = kBlendNoTexAlpha
DIVIDE = kBlendAlphaMult

NEG = kShadeEmissive
HARD = kMiscBindNext
TRANSLU = kBlendAlphaHighTest
RAYMIR = kMiscRestartPassHere
CSP = kBlendAlphaAdd
CMIR = kZNoZWrite

in the Textures panel these are the newly mapped flags:

if you chose NOISE as a texture rather than an image or a enviornment map, it will automatically export a plDynamicTexMap.

USEALPHA = kBlendAlpha

You still need a alpha color channel to use this blend flag, as before, but this way if you want to blend multiple textures on the same material, you set the USEALPHA only for layers that will be using the alpha, and it will not automatically set the flag for all layers as it did before (so only layers that need the alpha channel require this button, and will get this flag)
You can't stop the truth. IC Blog
User avatar
GPNMilano
 
Posts: 1155
Joined: Mon Apr 21, 2008 5:50 am

Re: PyPRP Discussion: Revised prp_MatClasses.py

Postby D'Lanor » Sat Apr 04, 2009 4:25 am

Before anything else, what was the reason for this change? Is it the inability of the Amb slider to split up the RGB channels?
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: PyPRP Discussion: Revised prp_MatClasses.py

Postby GPNMilano » Sat Apr 04, 2009 6:18 am

D'Lanor wrote:Before anything else, what was the reason for this change? Is it the inability of the Amb slider to split up the RGB channels?


The ambient slider still controls the preshade/runtime colors, that hasn't changed. So if you have your color set to white in blender, and the amb slider set to .5, like before the Preshade color in Uru will still be .5 for RGB and the runtime 1.0 for RGB. That hasn't changed.
Last edited by GPNMilano on Sat Apr 04, 2009 6:21 am, edited 1 time in total.
You can't stop the truth. IC Blog
User avatar
GPNMilano
 
Posts: 1155
Joined: Mon Apr 21, 2008 5:50 am

Re: PyPRP Discussion: Revised prp_MatClasses.py

Postby D'Lanor » Sat Apr 04, 2009 6:20 am

So what is the reason then? What actually does affect the ambient color in the current trunk?

Edit: ok, both questons answered. :)
Last edited by D'Lanor on Sat Apr 04, 2009 6:25 am, edited 2 times in total.
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Re: PyPRP Discussion: Revised prp_MatClasses.py

Postby GPNMilano » Sat Apr 04, 2009 6:22 am

The reason is there was no way prior to my revisions to control the ambient color selection in Blender. It wasn't mapped to anything that I could find other than the emitCol. This worked fine up until now. But there may be certain situations that require the ambient color to be split up among different RGB values. (SDL Layer animations being a big one) For this reason its important that the ambient color selection is mapped in blender to its own color selection set like the specular and runtime and preshade colors. By setting it the way I have it allows for 1. It to be set at the users preference for the color. and 2. If the ambient color needs to be animated it can be done so on a per-layer basis like the other flags.
You can't stop the truth. IC Blog
User avatar
GPNMilano
 
Posts: 1155
Joined: Mon Apr 21, 2008 5:50 am

Re: PyPRP Discussion: Revised prp_MatClasses.py

Postby Christian Walther » Sat Apr 04, 2009 7:15 am

A bit of context:

If libPlasma can be trusted, a plLayer has 4 RGBA colors: preshade, runtime, ambient, specular (I won't try to explain their exact meaning here as my research about that hasn't concluded yet - it depends on various flags). According to my research notes, they were previously mapped to Blender entities as follows:

Code: Select all
Plasma      Blender

preshade    ambient slider (Amb) * diffuse color (Col)
runtime     diffuse color (Col)
ambient     emit slider (Emit) * diffuse color (Col)
specular    specular color (Spe)


As your change is something that can easily be converted by a script in old scenes, it seems reasonable to me.

Why do it differently for animations and not always use the "Map To" color instead of the mirror color?
Christian Walther
 
Posts: 443
Joined: Sun Jun 08, 2008 3:10 am
Location: Switzerland

Re: PyPRP Discussion: Revised prp_MatClasses.py

Postby GPNMilano » Sat Apr 04, 2009 8:50 am

Mainly cause I mapped the ambient color first to the MirCol in blender. Than afterwards realized that the MirCol could not be animated in the current state of Blender's development. So I just mapped the animation to a separate color section. Eventually as I expand on the mat classes I'm hoping, if possible, to have all colors and flags set on a per layer basis. But thats a bit down the road as more and more will have to be reworked to make that possible.
You can't stop the truth. IC Blog
User avatar
GPNMilano
 
Posts: 1155
Joined: Mon Apr 21, 2008 5:50 am

Re: PyPRP Discussion: Revised prp_MatClasses.py

Postby GPNMilano » Sat Apr 04, 2009 9:11 am

A bit of context for those who are not familiar with the flags:

Lets say you have a lamp flare. With my set up, to get the best looking lamp flares, assuming you have a lamp flare with an alpha layer (like those seen in the city around the hand lamps or the spot lights in the hood) You'd start with your lamp flare texture. You'd have two vertex colors (your alpha layer should be a dark grey, while your color layer is grey). The colors for the material would be whatever color the lamp flare is supposed to be (if its red red etc) and you'd have both the the col and mircol set to this color. Make sure the AmbSlider is set to 0. Then in the texture settings, where you load your image, you'd select the USEALPHA button. and in the MAPTO section you'd select HARD and RAYMir. Also, if you want the lamp flare to be less opaque you can see through the texture a bit more this way) you'd set the COL slider in the MapTo section to something like .8. This will cause the texture to be less opaque, and give a more realistic view.

It all seems a bit complicated, but honestly once you get the hang of the settings it because very easy to blend stuff together and duplicate much of what Cyan did with their flares and blending with relative ease.

In the hood I'm working on for example, using the new matclasses i was able to duplicate stuff like a the fountain spotlights in Bevin, the imagers etc, the nexus stations etc and make them look just like Cyan's and work just like Cyan's.
You can't stop the truth. IC Blog
User avatar
GPNMilano
 
Posts: 1155
Joined: Mon Apr 21, 2008 5:50 am

Re: PyPRP Discussion: Revised prp_MatClasses.py

Postby boblishman » Sat Apr 04, 2009 10:30 am

I am confused ... I have lamp flares in Sonavio ... (and they look and behave like Cyan's) ... but by simply using a texture with transparancy ... and setting them as sprites ... :?
(they don't use ANY vertex colours ...there is no need ...the texture already has the transparency)


I don't understand why the (relatively simple) process of making a lamp flare needs to change (in this example anyway, ... maybe for other things the new class is better ... but I just think this seems complex for a "simple" lamp flare ... )
when it comes to Age creation ... "DOH" seems to be my middle name...
User avatar
boblishman
 
Posts: 882
Joined: Fri Oct 05, 2007 4:47 pm
Location: Spain

Re: PyPRP Discussion: Revised prp_MatClasses.py

Postby D'Lanor » Sat Apr 04, 2009 11:04 am

That is right, bobs flares are perfect without this. But I suppose this would be useful for animated lamp flares like flickering flames? (although I do not recall Cyan using those very often)
"It is in self-limitation that a master first shows himself." - Goethe
User avatar
D'Lanor
 
Posts: 1980
Joined: Sat Sep 29, 2007 4:24 am

Next

Return to Building

Who is online

Users browsing this forum: No registered users and 6 guests