[Closed] supersampling materials
Thanks for your answer and sorry for the “look” of the code. It became like this when i pasted it. Looks stupid, but i don’t know how to create a window like you did in your post to display script :wip:
I willl try your solution. Thanks again
I tried, it’s perfect and elegant.
Thanks again, i’ve learned a lot because of you.
Hope other people benefited of this thread.
It’s pretty simple :o) You have just to select your code and press # in the toolbar.
Here I am again, with another question related to this script.
Now the script is ok, it can handles all the standard materials of max (except raytrace in whixh the samplerUseGlobal propertie doesn’t seems to be exposed in maxscript and the morpher mat, because i’m lazy
But I want to complicate a little more the script…In fact it could be great to enable the kind of filtering (in this case “summed Area”) i want for each texturemap of each material and nested material.
For now i can do this for standard mat and “simple” multimaterial (with only standard mat used in it).
The problem is (again – i know, this time, i need a recursive loop to achieve this -) for multimaterial inside multimaterial.
In those cases my script crash.
Here is the code i use:
fn setFiltering mat =
(case classof mat of
(multimaterial: (matlist = #()
matlist = mat.materiallist as array
for i=1 to matlist.count do
(for j=1 to matlist[i].maps.count where classof matlist[i].maps[j] == bitmaptexture do
(matlist[i].maps[j].filtering = 1)
)
)
default: (for obj in selection where iskindof obj geometryclass do mat = obj.material.maps
for i = 1 to mat.count where classof mat[i] == bitmaptexture do mat[i].filtering = 1)
)--case
)--fn
on setFiltering_osd pressed do
(matSel=#()
for obj in selection where isKindOf obj GeometryClass do
(mat=obj.material
if mat!=undefined do (if findItem matSel mat==0 then append matSel mat)
)
for mat in matSel do setFiltering mat
)--on
Never use the default mode in this case. It is too dangerous, It’s certainly the source of the error.
And the recursive function receive already selected materials (called “mat” in all cases).
the function is really similar to the previous…
fn setFiltering mat =
(case classof mat of
(multimaterial: (for thisMat in mat.materiallist where thisMat!=undefined do setFiltering thisMat)
standardmaterial: (if classof mat.diffusemap == Bitmaptexture do mat.diffusemap.filtering = 1)
)--case
)--fn
The principe of an recursive function is that it call itself without in one case: when It find the value to change (standardmaterial here).
You can extend this function to others types now composite materials, …
Thank you again to answer me and so fast.
I understand the point.
But what if i want to filter ALL the maps in a material (not only the diffusemap), can i write this :
standardmaterial: (if classof mat.MAPS == Bitmaptexture do mat.MAPS.filtering = 1)
– I could try it, but i’m not in front of my workstation right now –
:hmm:
I don’t believe.That is a bit more complex because you have to scan all mat.maps by using mat.mapEnables and make the test for each.
standardmaterial:
(listMats=mat.maps
listMatEnables=mat.mapEnables
for sm=1 to listMats.count do
(if listMatEnables[sm] do
(if classOf listMats[sm]==Bitmaptexture do listMats[sm].filtering = 1)
)--for
)--standardmaterial
It’s possible that It exist a faster method but I don’t know it.
What are your projects for your script ?
Thanks again,
I will try your method.
About this script, that i will post soon, it’s just to help me manage big architectural scenes.
It’s a common problem when you make a movie with that kind of scenes (lot of building textures) to have some flicking and waving textures, mostly when faces become coplanar with the camera.
Enable supersampling for a building handling a lot of different textures at once is very nice and when the problem still remain, enabling a summed area filtering for all maps again at once is a big help.
Voila
I just upgrade this script. Now you can choose the supersampling method, the filtering method and the kind of texturemap you want to apply on (diffuse, opacity, bump and self-illum, which are the most impacted by the filtering).
I post this soon,
OK, that’s it. Now it’s done and improve.
- You can choose the kind of supersampling for all kind of materials and nested one too.
- You can choose the kind of filtering and on which maps you want to apply it. A “All” button let you apply the filtering for all kind of maps in material and nested ones.
- A show/Hide materials for selected objects or selected MEdit slot in viewport has been added.
limitations:
- Sampling and filtering doesn’t work on raytrace and morpher material.
2.Show/hide materials only works for standard and multimaterial for now.
to do:
1.Fix the above limitations.
2.add the options for Supersampling like quality, threshold…
Hope this help
Thanks again to PrettyPixel for his help on this script. I wouldn’t have done it alone.