• 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 Design & Development v
« Previous 1 … 6 7 8 9 10 11 Next »
Want to finalize a new wings_we:build for colors.

 
  • 0 Vote(s) - 0 Average
Want to finalize a new wings_we:build for colors.

ggaliens
Offline

Erlang Hacker
Posts: 954
Threads: 143
Joined: Nov 2012
#1
10-22-2014, 05:29 PM (This post was last modified: 10-22-2014, 06:20 PM by ggaliens.)
Want to finalize a new wings_we:build for colors.
I have one that works below in the MIDDLE with rgb vertex colors.
Problem with it as I see it is ... it probably used the wrong sort of accumulator to inject the vertex colors (maybe slow).
Looking for a better way.

Code:
%% build() -> We'
%% Create a we from faces and vertices or a mesh.
build(Mode, #e3d_mesh{fs=Fs0,vs=Vs,tx=Tx,he=He,vc=[]}) when is_atom(Mode) ->
    Fs = translate_faces(Fs0, list_to_tuple(Tx), []),
    #we{} = We = wings_we_build:we(Fs, Vs, He),
    wings_we:renumber(We,0);
build(Mode, #e3d_mesh{fs=Fs0,vs=Vs,tx=Tx,he=He,vc=[{_R,_G,_B}|_]=Vc}) when is_atom(Mode) ->
    Fs = translate_faces(Fs0, list_to_tuple(Tx), []),
    #we{vp=VPos} = We = wings_we_build:we(Fs, Vs, He),
    MyAcc = fun({Vi,_}, Acc) ->
         wings_va:set_vertex_color( gb_sets:singleton(Vi), lists:nth(Vi+1,Vc)  , Acc)
    end,
    We1 = lists:foldl(MyAcc, We, array:sparse_to_orddict(VPos)),
    wings_we:renumber(We1,0);
build(Fs, Vs) ->
    wings_we:renumber(wings_we_build:we(Fs, Vs, []),0).

Cool thing about this is that with a few lines of code changes to the .ply importer ... I can get some neat vertex colors to import from MeshLab.

OH ... some background. I have been doing some mesh analysis that seems to benefit from Ambient Occulsion type vertex colors. But the wings3d built in ambient occ ... is too slow on my models. MeshLabs is a great deal vaster and a bit different w.r.t. quality. So I figured ... try to get those MeshLab colors in via vertex color. I had thought about a WRL importer ... but when looking at ASCII PLY format ... it looked far simpler to just augment the current ply importer to bring in the vertex colors. This seems to be true after it was all said and done. Fairly few lines of code needed to import the vertex colors.
« Next Oldest | Next Newest »

Users browsing this thread: 1 Guest(s)



Messages In This Thread
Want to finalize a new wings_we:build for colors. - by ggaliens - 10-22-2014, 05:29 PM
RE: Want to finalize a new wings_we:build for colors. - by micheus - 10-22-2014, 08:53 PM
RE: Want to finalize a new wings_we:build for colors. - by ggaliens - 10-22-2014, 11:25 PM
RE: Want to finalize a new wings_we:build for colors. - by micheus - 10-22-2014, 11:43 PM
RE: Want to finalize a new wings_we:build for colors. - by micheus - 10-25-2014, 07:24 AM
RE: Want to finalize a new wings_we:build for colors. - by ggaliens - 10-26-2014, 12:27 AM
RE: Want to finalize a new wings_we:build for colors. - by ggaliens - 10-27-2014, 02:29 PM
RE: Want to finalize a new wings_we:build for colors. - by micheus - 10-27-2014, 04:08 PM
RE: Want to finalize a new wings_we:build for colors. - by ggaliens - 10-27-2014, 05:59 PM
RE: Want to finalize a new wings_we:build for colors. - by micheus - 10-27-2014, 11:22 PM

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

© Designed by D&D - Powered by MyBB

Linear Mode
Threaded Mode