• Website
  • Search
  • Member List
  • Help
  • Old Forum
  • Social Media
    •   @Wings3dOfficial
    •   @Wings3dOfficial
    •   Wings3dOfficial
    •   Wings3dOfficial
  • Register
  • Login
  • Website
  • Search
  • Member List
  • Help
  • Old Forum
  • Register
  • Login
Wings 3D Development Forum Wings 3D Gripes & Grumbles v
« Previous 1 … 3 4 5 6 7 8 Next »
I currently can't sphere/cylinder map this type of chart/cuts

 
  • 0 Vote(s) - 0 Average
I currently can't sphere/cylinder map this type of chart/cuts

ggaliens
Offline

Erlang Hacker
Posts: 954
Threads: 143
Joined: Nov 2012
#12
12-29-2015, 05:44 AM (This post was last modified: 12-29-2015, 05:49 AM by ggaliens.)
Depending on exactly what we want to do with the UV coordinates ... the mapping could be as simple as ...
Code:
command({vertex,{manifoldlab,spherical_y}}, #st{sel=[{WeID,Set}]}=St) ->
    wings_io:hourglass(),
    #we{} = We = gb_trees:get(WeID, St#st.shapes),
    [{_,MinY,_}=_Min,_Max] = wings_vertex:bounding_box(We),
    {_,Dy,_} = e3d_vec:sub(_Max,_Min),
    TWOPI = 2.0*math:pi(),
    MyAcc = fun(Vi, #we{}=Acc) ->
        {X,Y,Z} = wings_vertex:pos(Vi,We),
        U0 = (math:atan2(X,Z) + math:pi())/TWOPI, % range 0 - 1.0
        U = min(U0,1.0000),
        Temp = max(min(Y/(0.5*Dy),1.0),-1.0),
        V =  (math:asin(Temp) + math:pi()/2.0)/math:pi(),
        set_vtx_uv(Vi, {U,V}, Acc)
    end,
    We2 = gb_sets:fold(MyAcc, We, Set),
    wings_shape:replace(WeID,We2,St);

The issue with the above is that it does not address what happens when an arbitrary triangle crosses the U=1.0 boundary. That could be detected and handled properly if we iterated using FACES and if we assumed that the mesh was somewhat dense ... which is surely the case if we are trying to make a planet or moon.

Here is anther interesting UV mapping consideration ... I might need to look into ... not sure how Wings3D sets or handles UVs over-runs.

http://gamedev.stackexchange.com/questio...-less-than
« Next Oldest | Next Newest »

Users browsing this thread: 3 Guest(s)



Messages In This Thread
I currently can't sphere/cylinder map this type of chart/cuts - by ggaliens - 12-24-2015, 04:03 AM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by ggaliens - 12-24-2015, 06:28 AM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by micheus - 12-24-2015, 11:32 AM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by ggaliens - 12-24-2015, 04:43 PM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by ggaliens - 12-27-2015, 07:58 PM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by micheus - 12-28-2015, 07:47 AM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by ggaliens - 12-28-2015, 03:16 PM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by micheus - 12-28-2015, 03:32 PM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by ggaliens - 12-29-2015, 01:29 AM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by micheus - 12-29-2015, 02:45 AM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by ggaliens - 12-29-2015, 02:53 AM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by ggaliens - 12-29-2015, 05:44 AM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by micheus - 12-29-2015, 06:38 AM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by ggaliens - 12-29-2015, 02:53 PM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by micheus - 12-29-2015, 08:00 PM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by ggaliens - 12-29-2015, 08:07 PM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by micheus - 12-29-2015, 09:09 PM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by ggaliens - 12-29-2015, 11:33 PM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by micheus - 12-30-2015, 03:48 AM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by ggaliens - 12-30-2015, 04:00 AM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by micheus - 12-30-2015, 01:21 PM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by ggaliens - 12-30-2015, 03:01 PM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by ggaliens - 12-30-2015, 05:33 PM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by micheus - 12-30-2015, 06:31 PM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by map - 03-31-2016, 04:48 PM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by ggaliens - 03-31-2016, 10:43 PM
RE: I currently can't sphere/cylinder map this type of chart/cuts - by map - 04-21-2016, 04:57 PM

  • View a Printable Version
  • Subscribe to this thread
Forum Jump:

© Designed by D&D - Powered by MyBB

Linear Mode
Threaded Mode