[REQ] Blending system
[REQ] Blending system
Hi Ono and everyone who reads!
I report here a topic that i posted in the SkIndigo section yesterday: i've been told that my request should aim rather on the main rendering core structure than on the exporter..
My idea was to make the creation of complex blend materials a little easier, since now the material blending only allows the mix of 2 sub materials (even if they're made up of others sub materials in turn).
I suggested to have the possibility of choosing a number of sub-materials to be blended together, and then to specify the blending factor for each sub-material (the sum of the blending factors should be 1). This way I think the matrioska structure of sub-materials would be avoided, and it would be easier to set very complex blend mats.
Is it a good idea? What do you think?
PS. I attach a screenshot of what I have in mind concerning the handling of the new feature with SkIndigo; just to give you an idea.
I report here a topic that i posted in the SkIndigo section yesterday: i've been told that my request should aim rather on the main rendering core structure than on the exporter..
My idea was to make the creation of complex blend materials a little easier, since now the material blending only allows the mix of 2 sub materials (even if they're made up of others sub materials in turn).
I suggested to have the possibility of choosing a number of sub-materials to be blended together, and then to specify the blending factor for each sub-material (the sum of the blending factors should be 1). This way I think the matrioska structure of sub-materials would be avoided, and it would be easier to set very complex blend mats.
Is it a good idea? What do you think?
PS. I attach a screenshot of what I have in mind concerning the handling of the new feature with SkIndigo; just to give you an idea.
- Attachments
-
- blendmat_idea.jpg (157.43 KiB) Viewed 4934 times
actually I think this is something that can be done via exporter! The exporter simply does the multiple blend on export, without bugging you of generating "sub blend" materials...
Even if every material is limited to a texture based selection, the blending code could be done by the exporter
There is no need to force the user to work in Indigo logic
Even if every material is limited to a texture based selection, the blending code could be done by the exporter
There is no need to force the user to work in Indigo logic
polygonmanufaktur.de
not too tricky.
given that the total blend factor == 1 the formula for the blend factor of each mat is:
blend factor = ratio/total
if we have a total of 4 materials to be blended:
material1 0.4
material2 0.12
material3 0.2
material4 0.28
this will result in the following blend materials:
blend factor = 0.4/1.0
blend1: material1 + blend2 0.4
total -= .4
blend factor = 0.12/0.6
blend2: material2 + blend3 0.2
total -= .12
blend factor = 0.2/0.48
blend3: material3 + material4 0.416
assuming that that total blend factor != 1 one could normalize the ratios of each material given by just doing:
1/total blend factor*ratio
feel free to correct me, i might be totally wrong
given that the total blend factor == 1 the formula for the blend factor of each mat is:
blend factor = ratio/total
if we have a total of 4 materials to be blended:
material1 0.4
material2 0.12
material3 0.2
material4 0.28
this will result in the following blend materials:
blend factor = 0.4/1.0
blend1: material1 + blend2 0.4
total -= .4
blend factor = 0.12/0.6
blend2: material2 + blend3 0.2
total -= .12
blend factor = 0.2/0.48
blend3: material3 + material4 0.416
assuming that that total blend factor != 1 one could normalize the ratios of each material given by just doing:
1/total blend factor*ratio
feel free to correct me, i might be totally wrong
From my point of view this is what I see:
if we have
A - B C D
| | |
------
| |
--------
then
mat4* = mat4
mat3* = mat3 / (1-mat4*)
mat2* = mat2 / ((1 - mat3*)x(1-mat4*))
mat1* = mat1 / ((1 - mat3*)x(1-mat4*))
and so on...for higher hierarchical trees
where mat"n" is the desired blend value for material n
and mat"n"* is the real blend value that should be used inside the blend node.
Here's my 2 cents
R.
EDIT:
A is blended with B
A and B are blended with C
A and B and C are blended with D
...the forum removes additional spaces so my blend tree above sucks.
if we have
A - B C D
| | |
------
| |
--------
then
mat4* = mat4
mat3* = mat3 / (1-mat4*)
mat2* = mat2 / ((1 - mat3*)x(1-mat4*))
mat1* = mat1 / ((1 - mat3*)x(1-mat4*))
and so on...for higher hierarchical trees
where mat"n" is the desired blend value for material n
and mat"n"* is the real blend value that should be used inside the blend node.
Here's my 2 cents
R.
EDIT:
A is blended with B
A and B are blended with C
A and B and C are blended with D
...the forum removes additional spaces so my blend tree above sucks.
no, belending two blends is like blending 4 materials at the same level
if you want to blend three materials, you have to weight the blendfactors in order to get similar blend...
mat a,b,c
blendf x,y
(a(1-x)+bx)(1-y)+cy = (a-b)*x*(y-1)-(a-c)*y+a
to get a factor 1:1:1, you need to use x=1/2 and y=1/3, which simplifies to (a+b+c)/3, the average
You need to weight them from that in some way... probably by multiplying with the blendfactor, you had in mind, but I'm not sure... needs some additionaly thoughts...
if you want to blend three materials, you have to weight the blendfactors in order to get similar blend...
mat a,b,c
blendf x,y
(a(1-x)+bx)(1-y)+cy = (a-b)*x*(y-1)-(a-c)*y+a
to get a factor 1:1:1, you need to use x=1/2 and y=1/3, which simplifies to (a+b+c)/3, the average
You need to weight them from that in some way... probably by multiplying with the blendfactor, you had in mind, but I'm not sure... needs some additionaly thoughts...
The thing that bothers me about this request is that it would take me (and all the other exporter writers) a long time to hack all of this together, plus make changes to the UI and all of the testing that I have to do.Pibuz wrote:Ah, ok: now it makes a little more sense to my programming-naive mind!
Btw it all seems to be only about the complexity of the formula, but nothing Indigo cannot do as it is now. So, Whaat: what do you say? Will you give it a try? I'll be your test man!
Whereas, I bet Ono could implement a layered material type in Indigo in no time at all. It just makes more sense to me if this would be a native Indigo material. I am tired of hacking features together that should really be in the Indigo core in the first place (*cough* EXR rotation *cough*) oh...that's right, we apparently have it now.
Who is online
Users browsing this forum: No registered users and 20 guests