- Wed Aug 21, 2013 8:04 pm
#370386
Hi
This tool is for NURBS models, and you will need Rhino 5 sr3+ and an installation of the latest grasshopper.
surfaceRemapper.gh
there has been discussion about the RealScale feature in the past.
Keeping it short: it has it's limitations but is still useful to a certain extend.
What i am posting here is not a "maxwell-realscale" replacement, but a tool that could help us Rhino users to master this problem by means yet impossible.
in theory i have been thinking before about how a more powerful automated texturing tool could look like and now with the use of grasshopper, built a first prototype that partially solves Step 1 in a series of goals:
I am posting this so that anyone interested can join discussing what we can do about it from the rhino/GH side and to test/modify/improve the Grasshopper setup i attatched. there is still a way to go....
aim: using realscale but based on surface UV mapping
step1: determination of orientation in space. correcting U and V surface directions so that +V (top edge of texture) will point "upwards". this is eg. useful for a wall polysurfaces, and will synchronize all faces to the same orientation. flat faces (in xy plane, like ceiling and floor) are not modified. However this works for surfaces of any orientation, and will always scan or the steeper inclination (start>end iso U or start>end iso V) towards world unit Z vector. As you know, after exploding a polysurface, directions are usually random so this can be very useful for a set of tasks, see the images below on how this affects surfaces with arbitrary orientation.
this is functional in the .gh file i attatched. but there is one little problem i can't solve atm:
i am trying to use this litte VB script posted by D.Rutten here here to do the final UV alignment. However, A outputs an invalid Brep and i don't know why. If someone knows how come, let me know!!
I don't know how to extract the Brep Face in C# and work on that in order to keep the trim.
right now i am using this, so all the surfaces you input will be untrimmed:
once this is solved>
step2:
after the aligment, edge lengths of all surfaces will be extracted and compared. (check is performed on eg.mean length of untrimmed edge pairs)
the resulting differences are calculated back to respective U and V tiling values. THIS is where the actual "RealScale" is applied with all the benefits of keeping UV surface mapping.
technically i could build this in GH, but i don't see any Methods exposed in Rhino Commons which would let me set tiling, offset or UVW rotation values. Also outputting to a certain mapping channel would be very helpful. I can't even get there by rhino's command line.
however i have been following this thread and i think there is help on the way.
in any way this is rather sophisticated stuff, and i won't be able to solve the scripting part all by myself. so this will take some time... but i am pretty confident this will be possible in the close future
IF this is solved:
step3:
we can think about further options like rotating W or offsetting textures automatically;
it should be possible on a polysurface to define common edges, and to have offset computed in a way that no "jump" in a pattern is visible at the join... and so on.
exciting isn't it ?
please feel free to comment and give feedback or suggest new ideas!
cheers,
Daniel
ps. beware any bugs!
This tool is for NURBS models, and you will need Rhino 5 sr3+ and an installation of the latest grasshopper.
surfaceRemapper.gh
there has been discussion about the RealScale feature in the past.
Keeping it short: it has it's limitations but is still useful to a certain extend.
What i am posting here is not a "maxwell-realscale" replacement, but a tool that could help us Rhino users to master this problem by means yet impossible.
in theory i have been thinking before about how a more powerful automated texturing tool could look like and now with the use of grasshopper, built a first prototype that partially solves Step 1 in a series of goals:
I am posting this so that anyone interested can join discussing what we can do about it from the rhino/GH side and to test/modify/improve the Grasshopper setup i attatched. there is still a way to go....
aim: using realscale but based on surface UV mapping
step1: determination of orientation in space. correcting U and V surface directions so that +V (top edge of texture) will point "upwards". this is eg. useful for a wall polysurfaces, and will synchronize all faces to the same orientation. flat faces (in xy plane, like ceiling and floor) are not modified. However this works for surfaces of any orientation, and will always scan or the steeper inclination (start>end iso U or start>end iso V) towards world unit Z vector. As you know, after exploding a polysurface, directions are usually random so this can be very useful for a set of tasks, see the images below on how this affects surfaces with arbitrary orientation.
this is functional in the .gh file i attatched. but there is one little problem i can't solve atm:
i am trying to use this litte VB script posted by D.Rutten here here to do the final UV alignment. However, A outputs an invalid Brep and i don't know why. If someone knows how come, let me know!!
Code: Select all
so i am using a C# version of it, but the code only works on surfaces, so trim is lost. Private Sub RunScript(ByVal S As Brep, ByVal U As Boolean, ByVal V As Boolean, ByVal F As Boolean, ByRef A As Object)
If (S Is Nothing) Then Return
If (S.Faces.Count > 1) Then
__err.Add("Polysurfaces are not allowed")
Return
End If
Dim face As BrepFace = S.Faces(0)
Dim srf As Surface = face
If (U) Then srf = srf.Reverse(0)
If (V) Then srf = srf.Reverse(1)
If (F) Then srf = srf.Transpose()
Dim idx As Int32 = S.AddSurface(srf)
face.ChangeSurface(idx)
S.CullUnusedSurfaces()
A = S
End Sub
I don't know how to extract the Brep Face in C# and work on that in order to keep the trim.
right now i am using this, so all the surfaces you input will be untrimmed:
Code: Select all
private void RunScript(Surface srf, bool swapU, bool swapV, bool swapUV, ref object A)
{
if(swapV) srf = srf.Reverse(1);
if(swapU) srf = srf.Reverse(0);
if(swapUV) srf = srf.Transpose();
A = srf;
}
once this is solved>
step2:
after the aligment, edge lengths of all surfaces will be extracted and compared. (check is performed on eg.mean length of untrimmed edge pairs)
the resulting differences are calculated back to respective U and V tiling values. THIS is where the actual "RealScale" is applied with all the benefits of keeping UV surface mapping.
technically i could build this in GH, but i don't see any Methods exposed in Rhino Commons which would let me set tiling, offset or UVW rotation values. Also outputting to a certain mapping channel would be very helpful. I can't even get there by rhino's command line.
however i have been following this thread and i think there is help on the way.
in any way this is rather sophisticated stuff, and i won't be able to solve the scripting part all by myself. so this will take some time... but i am pretty confident this will be possible in the close future
IF this is solved:
step3:
we can think about further options like rotating W or offsetting textures automatically;
it should be possible on a polysurface to define common edges, and to have offset computed in a way that no "jump" in a pattern is visible at the join... and so on.
exciting isn't it ?
please feel free to comment and give feedback or suggest new ideas!
cheers,
Daniel
ps. beware any bugs!
workstation: EVGA SR-2 / dual x5650@3.5Ghz / quadro 4000