Orange branch feature; Material Layering
(WIP, don't bugs for this in tracker yet please!) - New Panel "Layers" in Material buttons, allows to add unlimited amount of materials on top of each other. - Every Layer is actually just another Material, which gets rendered/shaded (including texture), and then added on top of previous layer with an operation like Mix, Add, Mult, etc. - Layers render fully independent, so bumpmaps are not passed on to next layers. - Per Layer you can set if it influences Diffuse, Specular or Alpha - If a Material returns alpha (like from texture), the alpha value is used for adding the layers too. - New texture "Map To" channel allows to have a texture work on a Layer - Each layer, including basis Material, can be turned on/off individually Notes: - at this moment, the full shading pass happens for each layer, including shadow, AO and raytraced mirror or transparency... - I had to remove old hacks from preview render, which corrected reflected normals for preview texturing. - still needs loadsa testing!
This commit is contained in:
@@ -3994,6 +3994,40 @@ void single_user(void)
|
||||
|
||||
/* ************************************************************* */
|
||||
|
||||
/* helper for below, ma was checked to be not NULL */
|
||||
static void make_local_makelocalmaterial(Material *ma)
|
||||
{
|
||||
MaterialLayer *ml;
|
||||
ID *id;
|
||||
int b;
|
||||
|
||||
make_local_material(ma);
|
||||
|
||||
for(b=0; b<MAX_MTEX; b++) {
|
||||
if(ma->mtex[b] && ma->mtex[b]->tex) {
|
||||
make_local_texture(ma->mtex[b]->tex);
|
||||
}
|
||||
}
|
||||
|
||||
id= (ID *)ma->ipo;
|
||||
if(id && id->lib) make_local_ipo(ma->ipo);
|
||||
|
||||
for(ml=ma->layers.first; ml; ml= ml->next) {
|
||||
if(ml->mat) {
|
||||
make_local_material(ml->mat);
|
||||
|
||||
for(b=0; b<MAX_MTEX; b++) {
|
||||
if(ml->mat->mtex[b] && ml->mat->mtex[b]->tex) {
|
||||
make_local_texture(ml->mat->mtex[b]->tex);
|
||||
}
|
||||
}
|
||||
|
||||
id= (ID *)ml->mat->ipo;
|
||||
if(id && id->lib) make_local_ipo(ml->mat->ipo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void make_local(void)
|
||||
{
|
||||
@@ -4116,34 +4150,16 @@ void make_local(void)
|
||||
|
||||
for(a=0; a<ob->totcol; a++) {
|
||||
ma= ob->mat[a];
|
||||
if(ma) {
|
||||
make_local_material(ma);
|
||||
|
||||
for(b=0; b<MAX_MTEX; b++) {
|
||||
if(ma->mtex[b] && ma->mtex[b]->tex) {
|
||||
make_local_texture(ma->mtex[b]->tex);
|
||||
}
|
||||
}
|
||||
id= (ID *)ma->ipo;
|
||||
if(id && id->lib) make_local_ipo(ma->ipo);
|
||||
}
|
||||
if(ma)
|
||||
make_local_makelocalmaterial(ma);
|
||||
}
|
||||
|
||||
matarar= (Material ***)give_matarar(ob);
|
||||
|
||||
for(a=0; a<ob->totcol; a++) {
|
||||
ma= (*matarar)[a];
|
||||
if(ma) {
|
||||
make_local_material(ma);
|
||||
|
||||
for(b=0; b<MAX_MTEX; b++) {
|
||||
if(ma->mtex[b] && ma->mtex[b]->tex) {
|
||||
make_local_texture(ma->mtex[b]->tex);
|
||||
}
|
||||
}
|
||||
id= (ID *)ma->ipo;
|
||||
if(id && id->lib) make_local_ipo(ma->ipo);
|
||||
}
|
||||
if(ma)
|
||||
make_local_makelocalmaterial(ma);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user