mcjCylindricalUV: Script exports geometry with Cylindrical-Projected UV map

mCasualmCasual Posts: 4,607
edited November 2014 in Freebies

Download and manual ( uh hum )
https://sites.google.com/site/mcasualsdazscripts4/mcjcylindricaluv

Introduction

The script exports to disk a copy of the selected object with the new UV map
the UV map is "projected " either from location 0,0,0 or from the current position of the camera
The projection is cylindrical, and useful for dresses and ... all things vaguely cylindrical
I hope this script will help someone, but it wont always work flawlessly.

note that previously i covered Box, Spherical and Planar UV projections
https://sites.google.com/site/mcasualsdazscripts3/mcjboxuv
https://sites.google.com/site/mcasualsdazscripts4/mcjsphericaluv
https://sites.google.com/site/mcasualsdazscripts4/mcjplanaruv

cyl5.jpg
1250 x 516 - 179K
cyl2.jpg
1044 x 595 - 231K
cyl1.jpg
1280 x 720 - 466K
Post edited by Cris Palomino on

Comments

  • TiZTiZ Posts: 21

    Hey there. I wanted to add a cylindrical UV to that skirt I've been modifying, because I figure some skirt designs would be easier to make this way vs a planar projection, but this one has the same problem as the planar UV script. Could I trouble you to bring the update you made to that script to this one as well? Thank you very kindly for your time.

  • mCasualmCasual Posts: 4,607
    edited June 2022

    i think it may have to do with genesis things that dont name their surfaces the way old V3/V4 figures did

    i'll announce it in this thread when it's fixed

    in this test today, mcjCylindricalUVs only found the pectorals surfaces ( chessboard texture )

     

    note that a workaround that could work goes like this

    -pose the figure wearing the skirt

    -use mcjHideAllBut script to hide everything except the skirt

    - export the scene as an obj with the "Ignore invisible nodes" option ON

    - use mcjHideAllBut to make everything visible again

    - delete or hide the real skirt

    - import the obj that was exported to disk (it will fall exactly where the skirt was)

    - use mcjCylindricalUVs on the imported .obj

    the second big picture is the result of using t hat method

     

     

    indawoods.png
    768 x 1024 - 1M
    trick.jpg
    714 x 539 - 88K
    indawoods2.png
    768 x 1024 - 1M
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited June 2022

    work in progress 

    Fixin mcjCylindricalUVs for Genesis reasons

    but for now it exports all vertices (280k) instead of the selected surface's vertices (30K),

    but but on the other hand it allows importing the UV map of the exported .obj onto the Genesis figures/clothes so we'll leave it like that

    and the UV extents cover the whole figure so i may add a UV coordinates normalizer

     

     

    TiZ said:

    Hey there. I wanted to add a cylindrical UV to that skirt I've been modifying, because I figure some skirt designs would be easier to make this way vs a planar projection, but this one has the same problem as the planar UV script. Could I trouble you to bring the update you made to that script to this one as well? Thank you very kindly for your time.

    cyl00.png
    618 x 1000 - 595K
    cyl01.png
    618 x 1000 - 596K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited June 2022

    the update will be posted today

    the issue was that the script was expecting facet-group names  like upperAbdomen and lowerAbdomen, but for Genesix X they are named upperAbdomen and Abdomen

    same issue for the neck. i'll see about the arms, there's a twist bone and a bend bone, one of the 2 has no mesh associated to it

    and that's what i did last night instead of working on the two! script updates in progress :)

     

     

     

     

    Gabrielle Makes Friend With Kim of Planet Zenia Web.png
    2160 x 3840 - 4M
    Post edited by mCasual on
  • TiZTiZ Posts: 21

    Thank you very much for your work on this!! You're the man. :D

  • Silver DolphinSilver Dolphin Posts: 1,609

    Nice thank you

  • mCasualmCasual Posts: 4,607
    edited June 2022

    today today i complete the update, yesterday was mostly spent on this

    https://www.daz3d.com/forums/uploads/FileUpload/3f/cfda9b1a1a9a6d6c3f482b98643eb9.png

    twenty_four_not_six_to_four_left_eye_pov_by_mcasual_df7t5vp.png
    1280 x 1440 - 3M
    twenty_four_not_six_to_four_gray_anaglyph_by_mcasual_df7t6l5.jpg
    1280 x 1440 - 278K
    twenty_four_not_six_to_four_stereo_left_right_by_mcasual_df7t5z6.jpg
    2560 x 1440 - 521K
    Post edited by mCasual on
  • Silver DolphinSilver Dolphin Posts: 1,609

    Old school 3D is always cool.

  • mCasualmCasual Posts: 4,607
    edited June 2022

    Sorry to keep people who are waiting, waiting in utter desperation

    but if it can excuse me, the new version will output the same number and order of the uv coordinates, so you'll be able to import the UV map this way

    the .obj will contain only the facets you selected ( by material or by bone ) , but all the v's and all the vt's will be in the .obj

    The vt's of your facets will have  the new UV-Remapped vt's

    In other news, it went super summerfull here so i kinda was slack

    not as slack as people in The Church of Bob, they are the OG of slackness

    new VIDYO !!!!


    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited June 2022

    Good News

    The code of the script has shrunk down to about 1/3 of what it was

    this is always a good sign.

    so it's not ready but it's moving

    bu it's not ready

    but it's moving

    ok i stop bugging you

     

    The script will only accept the following selections

    - One whole figure

    or

    - One or many bones from 1 figure 

    or

    One node that has a mesh (ex: a primitive)

    ============

    This restriction is because i want the .obj files to have the same number of vertices, the same number of  uv coordinates and they have to be in the same order

    ... so this way the UVMap can be imported using the feature i used only once : "Load UV Set".

    the option to only export selected surfaces remains

     

     

     

    remake.png
    227 x 480 - 14K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607

    having trouble uploading images

    after having pasted an image in my clipboard in this leave a comment box

    but i dont know if it was the cause

    the relevant error in the browser console may be

    Unexpected token < in JSON at position [email protected]?v=1.8.42:495:33

    could be a corrupted cookie 

    cant post the image here either

     

     

  • barbultbarbult Posts: 24,380

    Forum uploads are failing for many people now.

  • Richard HaseltineRichard Haseltine Posts: 101,433

    Pasting images into the text box isn't supported anyway, they have tio be uploaded as attachments then they can be linked to inline. But yes, attach i sfailing for me too.

  • mCasualmCasual Posts: 4,607
    edited June 2022

    salutations Richard

    the image did paste in the edit box

    but there was a never-seen-before gray error-panel that appeared

    so i was thinking

    a- i crashed the fileUpload functionality for everybody and that's why it stalls

    or

    b- the programmers wrote that if someone causes a gray error-panel error, he gets no fileUpload for, say 24H or until some admin re-enables it

    t'was this picture

    ( to prevent hackers from bombarding the forum software with gray error panels the story would go )

     

    Richard Haseltine said:

    Pasting images into the text box isn't supported anyway, they have tio be uploaded as attachments then they can be linked to inline. But yes, attach i sfailing for me too.

    remake.png
    227 x 480 - 14K
    Post edited by mCasual on
  • Richard HaseltineRichard Haseltine Posts: 101,433

    There was an issue with file uploads, which was fixed later yesterday. Pasting an image (rather than a link) has never shown in the forum, though as you say it does - confusingly - show in the edit box.

  • mCasualmCasual Posts: 4,607
    edited June 2022

    i guess when the editor parses the message, it gets a blob that's that's encoded to something 2 times the size of the pasted image, and it falls in an error trap

     but luckily it doesnt crash the fileupload for everybody else !

     Twin Rocket Propelled WHEEZER MARK II.

     

    Richard Haseltine said:

    There was an issue with file uploads, which was fixed later yesterday. Pasting an image (rather than a link) has never shown in the forum, though as you say it does - confusingly - show in the edit box.

    GabbieRidez.png
    2560 x 1706 - 4M
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited July 2022

    it will come out don't worry :) and be better than before

    in due and dilated time

     

    timedilation.png
    1886 x 2022 - 2M
    Post edited by mCasual on
  • Eustace ScrubbEustace Scrubb Posts: 2,701

    Are the other UV-modifier scripts also getting (or needing) upgrades?

  • mCasualmCasual Posts: 4,607
    edited July 2022

    possibly the Spherical one when it comes to edges that cross the 0 degrees/360 degrees projection angle

    i think i have to detect vertices that have a more than 180 degrees angle separation and shift the offending facets uv coordinates to the right

    so a segment going from UVu = 0.25 to 0.875 becomes the segment from  UVu 0.875 to 1.125

     

    the bug makes interesting patterns though

     

    Eustace Scrubb said:

    Are the other UV-modifier scripts also getting (or needing) upgrades?

    patient2.png
    1280 x 720 - 845K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited July 2022

    i may get it ready tonite once the zero-crossing issue is solved

    down the road someday i may convert this into a Daz Studio plugin for mac/pc

    because it would be X times faster.

    the faulty edges uv.u have a distance greater than 0.5 i think, so far since it's a cylindrical projection 

    uvwoes2.jpg
    999 x 1662 - 155K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited July 2022

    Ladies and gentlemen we got him.

    The 0°-crossing problem of mcjCylindricalUVs has been vanquished

    i think

    the fix is as follow:

    function zeroCross( vIdx1, vtIdx1, vIdx2, vtIdx2 )
    {
    uv1 = g_uvSet.getPnt2Vec( vtIdx1 );
    uv2 = g_uvSet.getPnt2Vec( vtIdx2 );
    //ex:.875 to .125 bad
    //ex: .125 to .875 bad
    //ex .625 to .375 ok
    //ex .375 to .625 ok
    olduv1x = uv1.x;
    olduv2x = uv2.x;
    
    //avoiding multiple uv.u += 1.0
    if( uv1.x > 1.0 ) 
    uv1.x -= 1.0
    if( uv2.x > 1.0 )
    uv2.x -= 1.0
    //it's impossible for 2 vertices to be separated by more than 180 degrees
    if( Math.abs( uv1.x - uv2.x ) > 0.5 ) 
    {
    if( uv1.x < uv2.x )
    {
    uv1.x += 1.0
    g_uvSet.setPnt2Vec( vtIdx1, uv1 );
    }
    else
    {
    uv2.x += 1.0
    g_uvSet.setPnt2Vec( vtIdx2, uv2 );
    }
    debug( olduv1x, olduv2x, "fix to", uv1.x, uv2.x );
    //later on we normalize all the uv.u
    if( uv1.x > g_maxUVu )
    g_maxUVu = uv1.x;
    if( uv2.x > g_maxUVu )
    g_maxUVu = uv2.x;
    }
    }

    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited July 2022

    a whole figure cylindrically re-uv-mapped

    The mcjCylindricalUV re-uv-mapper Daz script fix is nigh.png
    1000 x 1200 - 587K
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607
    edited July 2022

    as i may have told you, the new version aims to preserve the number of uv coordinates so that the UVmap

    can be imported using Daz Studio's surfaces tab's "Load UV Set..." function

    but we can only unfold a tube and lay it down a flat square if that tube has a vertical cut in it.

    so my method of shifting uv.u's by +1.0 that solved the issue for the "zero-degrees-crossings" worked

    for the cube but wont work for a seamless tube like this dress

    there's a method wherein you can flatten the tube but with this method with this method,

    half the texture image would be horizontally inverted (mirrored)

    or i could have the script to look for the vertical cut of the original map, which, come to think of it must be near uv.u = 0

    in some rare cases there's no vertical cut, in other cases there's many uv "shells"

    for example this untouched uv map for the daz studio cylinder primitive has 3 shells

    with our tubular projection ( cylinder with no caps ) the horizontal facets are seen as lines, which is not really a defect

    adding top-bottom uv shells would not work for a shape like this:

     

    wazup.png
    500 x 600 - 523K
    tube.jpg
    578 x 535 - 31K
    weirdoshape.png
    1000 x 1200 - 2M
    Post edited by mCasual on
  • mCasualmCasual Posts: 4,607

    well i dont have the script ready but i got a vidyo with cool pics

    ok ok that's not the same as a script

    so, since the cylindrical mapping that preserves the texture-vertices count ...  has that zero-crossing issue

    i will just make the old version compatible with the Genesis bone/group names

    which gives us a nice UV map , like the old version but isnt loadable as a UV-set

    contrary to the old version i'll also weld/merge the texture-vertices that coincide

    ( to solve the zero-crossing issue, we mentioned that we were moving some texture-coordinates

    by +1.0, but since the map was welded it was stretching facets that shouldnt be stretched )

Sign In or Register to comment.