it’s good. we need it. can we have it?
CompositeMaterial for 4.0Software: Away3D 4.x |
||
|
||
Richard Olsson, Administrator
Posted: 24 September 2011 01:23 PM Total Posts: 1192 [ # 1 ] What do you need it for? In 3.6, The composite material was mainly used to enable shading (using a shading material) on a material that otherwise didn’t support it. That’s no longer required in Away 4 where any material can have any shading method, and even daisy chain some of the methods. If you can please explain the use case, it might be easier to assess whether it is something that we want to add, or if there is maybe some better way of doing it. |
||
Choons, Sr. Member
Posted: 24 September 2011 05:56 PM Total Posts: 281 [ # 2 ] Alejandro mentioned shading as well in a different thread, but I only ever saw it as a way to use several different materials dynamically on a single model at once. I used CompositeMaterial in a garment configurator design. The fabric texture of the garment needed to be tiled onto the model and UV scaled down to retain fine detail on zooming. The user then could choose graphic elements to add to the garment and could position, rotate, and scale them anywhere on the garment they please. The graphics require a material that is not set to repeat in contrast to the fabric texture material. Other details like stitching or zippers could be added as well. So I used CompositeMaterial as a container much the way ObjectContainer3D is used except for multiple TransformBitmapMaterial and regular BitmapMaterials so that they could all be easily applied to the same model and manipulated individually. Flash’s BitmapData & matrix transform stuff can handle some of that, but it’s a lot harder to use. Also there is no way to composite it all together with an underlying fabric texture. Trust me I’ve tried, it just washes out all detail unless you use some kind of absurdly huge bitmap and even then looks awful. Fabric texture really requires UV scaling and tiling by itself. So at the very least 2 materials are required for this- one with repeat turned on and one with repeat off. I welcome any suggestions of a way to do it in 4.0. I’ve considered perhaps splatting layers. It just seems like CompositeMaterial made stuff like this so easy to do that I am amazed the devs don’t think it’s useful to port over to 4.0 |
||
Richard Olsson, Administrator
Posted: 24 September 2011 06:05 PM Total Posts: 1192 [ # 3 ] First of all, UV coordinates are attributes of the geometry, and has nothing to do with the materials. Now that we are on the GPU there is no real way of faking that. This means that the only real way to solve what you’re after (one repeated texture with scaled UVs, one without) is to have multiple UV channels. That’s something that is possible already, but you likely won’t find a transfer format that lets you just parse it into Away3D. So consider either using separate meshes, or exporting the extra UV channel on your own somehow and adding it after you have loaded your meshes. Your use of the CompositeMaterial is an interesting case, but it is likely not a good idea when you’re working on the GPU. |
||
Choons, Sr. Member
Posted: 24 September 2011 06:14 PM Total Posts: 281 [ # 4 ] well it’s going to be a basic need for product configurators to layer on graphics elements like that. If it’s impossible to do on hardware then that’s one thing, but it is quite useful. I don’t know how multiple UV channels was “faked” in 3.6 but it sure allows for for some very cool things that cannot be done in 4.0 |
||
Richard Olsson, Administrator
Posted: 24 September 2011 06:42 PM Total Posts: 1192 [ # 5 ] You’re probably right about the need to achieve this kind of thing. And the best way to do it is probably using multiple UV channels. |
||
John Brookes, Moderator
Posted: 24 September 2011 06:43 PM Total Posts: 732 [ # 6 ] Can’t you just add a new subgeometry for each layer? |
||
|
||
John Brookes, Moderator
Posted: 25 September 2011 08:05 AM Total Posts: 732 [ # 8 ] Just had a little play again. Also, never noticed before, the images have to be created in reverse order. (background last) And im not talking about the animation thang. The basics is
private function initObjects():void No idea if the above has anything to do with what you wanted :/ |
||
Choons, Sr. Member
Posted: 25 September 2011 08:31 AM Total Posts: 281 [ # 9 ] man, thanks for exploring it like that. Yeah I was really against the change of moving the UV ops from being a material property a while back for this reason. Your approach gives back the flexibility of the old system. Nicelly done! So yeah the usefulness of being able to layer on content like that seems pretty apparent to me. Good to know there is a way to do it apart from Flash’s bitmap ops. Now let’s see if it makes it into the framework proper. Thanks, John
|
||
|
||
John Brookes, Moderator
Posted: 25 September 2011 09:07 AM Total Posts: 732 [ # 11 ] Yeah, could have added U and V parameters (x,y) to the function or even a vector3D without the z. Just used point. |
||
John Brookes, Moderator
Posted: 25 September 2011 09:56 AM Total Posts: 732 [ # 12 ] Just found an old post from when I first started playing with UVs in broomstick. |
||
inSertCodE, Sr. Member
Posted: 18 November 2011 12:36 AM Total Posts: 105 [ # 13 ]
Sorry to bump this… How can we create a second UVW channel? The method used below works great and does the job but it has a downside. It doubles the geometry vertex/faces/ UVW coordinates ect. You mentioned there is a way to add a second UVW channel so I would appreciate it if you share with us how. Thanks. |