Home › Forums › Programming › Parametric Objects
- This topic has 3 replies, 2 voices, and was last updated 6 years, 8 months ago by Mikhail Luzyanin.
-
AuthorPosts
-
2018-04-10 at 8:44 pm #3477jemCustomer
Hi,
I am investigating the possibility of dynamically scaling objects. The Verge3D API supports single and multi-axis scaling. The code is simple. Scaling might be a good solution for simple parametric objects.This technique works well for basic materials. It does not work well for materials that require UV maps. I have provided a link to a simple example that you can play with. You can make the objects larger or smaller by clicking on the arrows. You can see that this technique works well for the top blue cube but the lower cube has problems. On the lower cube, the material begins to distort as the length changes. I believe that the distortion happens because of the vertices in UV map do not change as the object changes size. This is not surprising.
I considered writing a function using the API that would dynamically update the object’s UV array but I recognize that: #1 this is too difficult for me and #2 this solution would only work for very simple shapes under very simple conditions. So, I did not attempt to do this.
Does anyone in the community have ideas how this could be done well? I would love the feedback.
Thanks,
Jem.Jeremy Wernick
2018-04-11 at 10:24 am #3492Mikhail LuzyaninStaffHi, Jem. Look at THIS EXAMPLE we made for you. May be this will be useful. Also attached a working example. You can control mixing of the textures with the value inside the material.
Attachments:
You must be logged in to view attached files.Co-founder and lead graphics specialist at Soft8Soft.
2018-04-11 at 7:35 pm #3505jemCustomerHello Mikhail,
Thank you very much for this amazing example. I am still trying to understand everything that you did in your example. I am not very good with the shader node system but I will work hard to learn.In your example, I see that the material is mapped with the global coordinate system rather than the object’s local coordinate system. That is very smart. I also see that you are using the object’s normals to set the rotational transformations for the material to the object’s other faces. This is where I get lost, but I will try to understand it.
Thank you!
-JemJeremy Wernick
2018-04-12 at 7:27 am #3510Mikhail LuzyaninStaffIn your example, I see that the material is mapped with the global coordinate system rather than the object’s local coordinate system. That is very smart. I also see that you are using the object’s normals to set the rotational transformations for the material to the object’s other faces. This is where I get lost, but I will try to understand it.
Textures place on the object using global coords as you mentioned but normals directions used as b/w masks to separate one texture from another so they placed each from they own side. Math node used just to shift this mask a little (add math node) or make them sharper or more smooth (multiply math node).
Co-founder and lead graphics specialist at Soft8Soft.
-
AuthorPosts
- You must be logged in to reply to this topic.