[Question] Is it possible to get a point on UV ?
-
Is it possible to get a specific point on the UV's?
I've looked at the UVHelper but I dont get how it works. And whats that with using textureWriter with UVHelper?What I want is something like
point = face.texture_coord (u,v)
to be able to color each "point" on a face differently instead of each face getting the same color.
-
Yea, the texture write is a bit weird.
@pixero said:
to be able to color each "point" on a face differently instead of each face getting the same color.
Not quite sure what you mean by this... You want colour information? Or you want the 3D co ordinate of that specific UV point on that face?
-
I'm looking for a way of accessing each point of a surface/texture.
I've experimented with textures like the ones Chris Fullmer has written and having access to any UV point that would (hopefully) make it possible to write procedural textures like noise or gradient ramps. It would make it possible to do smooth shading of a surface instead of the
one-color-per-face gradient type that is currently possible.I've written a lot of mentalray shaders and was hoping to find a way of "porting" at least some of that to SU.
In mentalray you have for example:
state->point that gives you the intersection point of a surface.
state->tex_list[0].x which gives you the U in UV coordinate and so on.I dont understand how UVHelper works?
In the Ruby docs it says:
face.outer_loop.vertices.each do |vert|
uvq = uv_helper.get_front_UVQ(vert.position)Does that gives you just the position of the geometric vertices or also every UV point inbetween the vertices?
I don't know if I make myself clear. -
@pixero said:
I'm looking for a way of accessing each point of a surface/texture.
Still don't understand what you by "point" - I take it it's not an Point3d object?
SU's methods lets you get the UV (x,y) coordinates of a Point3d object. That's about it.
There is no way you can read/write colour data. That is unless you find a way to read the image formats the Sketchup uses. There's no built-in methods that does that.
-
@thomthom said:
SU's methods lets you get the UV (x,y) coordinates of a Point3d object. That's about it.
Forget about any color data at the moment.
UV's are 0 to 1, right?
Lets say we have a face with its four corner vertices at 0,0 0,1 1,0 and 1,1 in UV space.
Now if I want to access a "UV position"/"point" between these, lets say 0.5, 0.5 (or any other "UV position").
Is that possible? -
Yes, you can get any Point3D from any UV co-ordinates as long as it's on the face's plane.
-
Yes, now I'll start digging...
-
I got two plugins that deals with UV mapping. You can look at how I use it - maybe that gives you some clues to what you want to do.
-
I will, thanks.
Advertisement