[REQ] Blending system

Feature requests, bug reports and related discussion
User avatar
Pibuz
1st Place 100
Posts: 2646
Joined: Tue Dec 11, 2007 7:58 am
Location: Padua, Italy
3D Software: SketchUp

[REQ] Blending system

Post by Pibuz » Tue Jan 20, 2009 8:40 pm

Hi Ono and everyone who reads! :D
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
blendmat_idea.jpg (157.43 KiB) Viewed 4934 times

User avatar
mrmoose
Posts: 130
Joined: Mon Jun 26, 2006 7:45 pm

Post by mrmoose » Tue Jan 20, 2009 8:52 pm

Layer material, in other words :wink:

User avatar
Pibuz
1st Place 100
Posts: 2646
Joined: Tue Dec 11, 2007 7:58 am
Location: Padua, Italy
3D Software: SketchUp

Post by Pibuz » Tue Jan 20, 2009 9:05 pm

:D Yeah: sort of... :D

User avatar
Zom-B
1st Place 100
Posts: 4700
Joined: Tue Jul 04, 2006 4:18 pm
Location: ´'`\_(ò_Ó)_/´'`
Contact:

Post by Zom-B » Tue Jan 20, 2009 10:14 pm

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 :lol:
polygonmanufaktur.de

User avatar
Pibuz
1st Place 100
Posts: 2646
Joined: Tue Dec 11, 2007 7:58 am
Location: Padua, Italy
3D Software: SketchUp

Post by Pibuz » Wed Jan 21, 2009 12:36 am

Hi ZomB! I thought the same thing, at first. But then i posted this request in the SkIndigo forum and Whaat told me to make this request general, rather than for SkIndigo only, 'cos the workarounds for avoiding the matrioska structure would be tricky!

User avatar
fused
Developer
Posts: 3648
Joined: Fri Sep 22, 2006 7:19 am
Location: Berlin, Germany
3D Software: Cinema 4D

Post by fused » Wed Jan 21, 2009 1:08 am

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 :)

User avatar
Pibuz
1st Place 100
Posts: 2646
Joined: Tue Dec 11, 2007 7:58 am
Location: Padua, Italy
3D Software: SketchUp

Post by Pibuz » Wed Jan 21, 2009 1:53 am

What can I say?
I trust you guys!
I hope Whaat is following this topic and will be able to translate all of this stuff in SkIndigo language :D

User avatar
rgigante
Posts: 326
Joined: Wed Jun 28, 2006 6:46 am
Location: Italy

Post by rgigante » Wed Jan 21, 2009 3:08 am

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.

User avatar
Pibuz
1st Place 100
Posts: 2646
Joined: Tue Dec 11, 2007 7:58 am
Location: Padua, Italy
3D Software: SketchUp

Post by Pibuz » Wed Jan 21, 2009 3:15 am

I don't want to be picky, guys..

But.. just wondering... :?:

...Blending together 2 blended mats gives the same result as if we blend 3 materials at "the same level"?
If so, GREAT! So it's only a matter of exporter! Good news! For Ono...

User avatar
rgigante
Posts: 326
Joined: Wed Jun 28, 2006 6:46 am
Location: Italy

Post by rgigante » Wed Jan 21, 2009 5:11 am

Yes Pibuz, it's only a matter of exporter!

User avatar
Kram1032
Posts: 6649
Joined: Tue Jan 23, 2007 3:55 am
Location: Austria near Vienna

Post by Kram1032 » Wed Jan 21, 2009 8:13 am

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...

User avatar
Pibuz
1st Place 100
Posts: 2646
Joined: Tue Dec 11, 2007 7:58 am
Location: Padua, Italy
3D Software: SketchUp

Post by Pibuz » Wed Jan 21, 2009 8:40 pm

Ah, ok: now it makes a little more sense to my programming-naive mind! :lol:

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!

neo0.
Posts: 1784
Joined: Thu Feb 28, 2008 7:11 am
Location: the US of A

Post by neo0. » Tue Jan 27, 2009 5:38 pm

Looks good, but the hierarchy of the mats isn't very clear with this approach..

User avatar
Whaat
Developer
Posts: 1827
Joined: Fri Dec 22, 2006 6:15 am
Location: Canada
Contact:

Post by Whaat » Tue Jan 27, 2009 5:55 pm

Pibuz wrote:Ah, ok: now it makes a little more sense to my programming-naive mind! :lol:

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!
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.

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. :P :)

User avatar
Pibuz
1st Place 100
Posts: 2646
Joined: Tue Dec 11, 2007 7:58 am
Location: Padua, Italy
3D Software: SketchUp

Post by Pibuz » Tue Jan 27, 2009 8:13 pm

No problem: i don't want you to lose huge times!
Let's hope Ono implement the main core, instead! :D

Post Reply
18 posts

Who is online

Users browsing this forum: No registered users and 20 guests