Where have materials scaleU and scaleV disappeared in Away4
Software: Away3D 4.x
SasMaster, Sr. Member Posted: 28 June 2011 04:22 AM Total Posts: 127
Hi all. I was playing around with the latest build of Broomstick and needed to tile a plane. An I remembered from some work I have done a couple of months ago that BitmapMaterial had scaleU and scaleV properties that allowed me to define a number of tiles .Now I see those are gone.So how do I tile a bitmap in a BtimapMaterial?
Richard Olsson, Administrator Posted: 28 June 2011 09:34 AM Total Posts: 1192
[ # 1 ]
Since UV coordinates are really related to geometry rather than materials, we have moved the UV transformation properties to SubMeshes recently. This has the added benefit that you can reuse materials between several meshes, even if you don’t want them to animate exactly the same. SubMeshes need to be redrawn individually anyway, so it makes more sense to put these properties on the SubMesh for that reason as well.
You can get to the sub-meshes using the subMeshes vector getter on Mesh.
SasMaster, Sr. Member Posted: 28 June 2011 09:40 AM Total Posts: 127
[ # 2 ]
Thanks for that info ,although I think it was more convenient to have these properties on materials.While UV is in fact related to geometry it serves mostly the contents of materials.And logically ,one would look for tiling settings inside a material and not in a mesh.
theMightyAtom, Sr. Member Posted: 28 June 2011 06:09 PM Total Posts: 441
[ # 3 ]
Choons, Sr. Member Posted: 28 June 2011 07:06 PM Total Posts: 281
[ # 4 ]
gotta agree with [Michael] on this one. UV might technically be related to geometry, but it’s a material property.
Being able to reuse materials is a great argument for making sure UV settings aren’t global, but maybe it could be more intuitive in code like mymesh.material.offsetU where even though the material might reference a global material, the change is made in the context of the mesh it’s assigned to.
SasMaster, Sr. Member Posted: 28 June 2011 07:30 PM Total Posts: 127
[ # 5 ]
Agree with Pete or with me ?
Choons, Sr. Member Posted: 28 June 2011 07:41 PM Total Posts: 281
[ # 6 ]
right - Pete. Although I often agree with you as well ; ) I have the same problem with Dave and David
Choons, Sr. Member Posted: 28 June 2011 07:45 PM Total Posts: 281
[ # 7 ]
woops or Michael maybe. hell let’s get the whole Bible in here lol
SasMaster, Sr. Member Posted: 28 June 2011 07:49 PM Total Posts: 127
[ # 8 ]
As far as I can see in this thread Pete (Peter) put an example.So I don’t get what you mean under “gotta agree with Pete” .Also my name is Michael and nice to meet you! ) .
Anyway,on the second thought I think it is wise to have tiling settings on the mesh level and not inside a material.That is because if one needs to reuse the same material but with not tiling will have a problem in such a case.
PS:the only remark I have here is to have some change log so the users can have a clue where these props are gone.(is there a change log at all > ? )
SasMaster, Sr. Member Posted: 28 June 2011 07:50 PM Total Posts: 127
[ # 9 ]
Choons - 28 June 2011 07:45 PM
. hell let’s get the whole Bible in here lol
He He ,That is a good one!
Choons, Sr. Member Posted: 28 June 2011 07:52 PM Total Posts: 281
[ # 10 ]
yeah Michael I know you well, just got my Bible names mixed up for a moment.
I agree about the changelog too. One of my demos makes large use of UV offsetting and scaling and would just be broken without me knowing why.
3D Studio (and others) take a Belt and Braces approach, where you can assign tiling attributes on a material, as well as scaling UV’s on a particular object. Both are taken into account in the render cycle.
That gives you the most flexible solution, as you can update globally, by updating the material tiling, or locally by scaling the meshes UV’s. In order to replicate these settings when a file is imported into Broomstick, both options need implementing. Material tiling was ignored last time I tried.
(that’s what “Pete” thinks! )
Choons, Sr. Member Posted: 29 June 2011 10:29 PM Total Posts: 281
[ # 12 ]
this has screwed up my F-16 demo. I changed my settings from terrain_material.offsetU += 0.03125; to terrain_plane.subMeshes.offsetU += 0.03125; but apparently it now offsets differently. truly aggravating
Choons, Sr. Member Posted: 29 June 2011 10:40 PM Total Posts: 281
[ # 13 ]
actually it doesn’t seem to be offsetting it at all
First of all, we’re in alpha. We don’t maintain any changelogs between commits. If you want to keep up to date with what’s happening, read the git logs (which you should always do anyway when you pull.)
Remember that Away3D is a real-time engine. 3dsmax can take a day to render a frame, but we have to do it in 17 milliseconds. If we have to choose, then it makes sense to optimize for performance rather than optimize for ease-of-use. That said, we will discuss the double-approach, which I have thought about as well but (perhaps mistakingly) discarded because of performance.
Thanks Richard, I did wonder if it was for performance reasons. Maybe it could be implemented in such a way that the scaling factor need only be calculated when a material is actually created or modified? (i.e. once on model import for most situations).
The argument for implementing both material tiling AND mesh UV scaling, would be to offer full support for formats such as 3DS, rather than having to explain why things don’t look the same right out of the box.
The workaround for anyone reading this for reference, is to keep your material tiling to 1.0 in all directions in you 3D package, and adjust the models UV coords instead.