How to get face uvs if texture is applied to component inst
-
@thomthom said:
Will that give matching UV data? If so, then that should be a lot faster than applying the material to the faces, sample UV data, then remove it again.
Yeah I'd imagine I could just homebrew my own uv information but I'd rather just use theirs if possible. I am not sure if your solution would take into account the various translations, etc, that can be done with textures on faces.
-
You can get the UVs by extracting the PolygonMesh object from the face. (Face.mesh)
The UVs that you will get will need to be divided by the texture size that is set using the SketchUp materials editor. If the texture is applied directly the face, you can get the UVs directly (i.e. not dividing by the texture height and width).
-
@whaat said:
The UVs that you will get will need to be divided by the texture size that is set using the SketchUp materials editor. If the texture is applied directly the face, you can get the UVs directly (i.e. not dividing by the texture height and width).
Ok I will give that a shot, I thought I was just getting garbage uvs...I hadn't thought that they were the actual uvs just not set to the proper repeat value. Wow...
I'll let you know how this goes.
-
I did a quick test. I took the UV data from the faces with default material, and divided them with the Height and Width of the components material's texture, and then used position_material. The mapping seemed to be identical.
-
@jbacigalupa said:
You can see the outline of the faces completely in render 1 - and in render 2 you can't. So that is where my assumption about the smooth tool came from. I am not sure if thats what it is but it seems like I'm breaking a "connection" or something when I modify the material. Maybe if I could do a batch material apply operation it would work out better...but since this is just a workaround to get uv info I don't want to muck around too much with the person's scene.
I've seen that happen. But I don't understand why. What do you do to determine if two faces should be smoothed?
As mentioned, theedge.smooth?
andedge.soft?
seem to remaintrue
after you apply a material to the faces connected to it. -
@whaat said:
You can get the UVs by extracting the PolygonMesh object from the face. (Face.mesh)
The UVs that you will get will need to be divided by the texture size that is set using the SketchUp materials editor. If the texture is applied directly the face, you can get the UVs directly (i.e. not dividing by the texture height and width).
Ah! Didn't see that post. Seems to confirm my theory and testing.
I guess this means, the parsing of groups/components with materials applied to them won't produce such an overhead any more.
-
Shhh, don't jinx it... Joe got sucked off to a meeting, but we have managed to render a sphere with no faceting so far! I don't know what kind of impact this will have on scene parsing... fingers are crossed.
-
@thomthom said:
I guess this means, the parsing of groups/components with materials applied to them won't produce such an overhead any more.
Yeah - so far it looks like the width/height divide was all we needed. Thanks to Whaat and ThomThom for your help - that issue has annoyed me for so long.
I wish I came to this forum sooner!
-
@whaat said:
You can get the UVs by extracting the PolygonMesh object from the face. (Face.mesh)
The UVs that you will get will need to be divided by the texture size that is set using the SketchUp materials editor. If the texture is applied directly the face, you can get the UVs directly (i.e. not dividing by the texture height and width).
Doesn't a PolygonMesh return only triangles? Can you get UV data for distorted textures from just 3 points?
Face.position_material requires four samples to set a distorted texture.Here, sample file:
uv_sample.skpIt contains two identical faces, both triangles. One face has a distorted texture, the other not.
uv_sample.rb
This script has two different methods to copy the UV mapping from the one face to the other.
Select the two faces, ensure one of them does not have a material applied, and try out the following two methods.sample_vertex
- samples UV data from the three vertices of the triangle. Notice that the transferred texture does not match.sample_plane
- Picks four points from the face's plane. Notice that the transferred texture is identical. -
thomthom:
have you released that UV inspector plugin that you show in one of your posts above? I was looking for it the other day and I couldn't find it. It would be really useful to me.
-
seems were having a good news for vraysu here....
-
@whaat said:
thomthom:
have you released that UV inspector plugin that you show in one of your posts above? I was looking for it the other day and I couldn't find it. It would be really useful to me.
http://forums.sketchucation.com/viewtopic.php?f=180&t=21472
Though, I just noticed some weirdness when probing through groups/components. When I was testing the cylinder I'd draw the info correctly for every other face.
Need to track down a bug there.
-
Thanks Thomas!
Advertisement