Elmar Posted February 9, 2010 Share Posted February 9, 2010 Hello, I have a 3d object.I want to include this object to my program as mesh and create visualization of this object. But this object contains of some parts.(for example cube, sphere etc.) How i can to set different textures to different parts? Please, help me. Quote Link to comment Share on other sites More sharing options...
Canardia Posted February 9, 2010 Share Posted February 9, 2010 PaintEntity( FindChild(model,"meshname"), LoadMaterial("abstract::matname.mat") ); Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Elmar Posted February 10, 2010 Author Share Posted February 10, 2010 I can add this object as one mesh and apply texture to it. But I want to apply custom textures to custom parts of this mesh. Quote Link to comment Share on other sites More sharing options...
wh1sp3r Posted February 10, 2010 Share Posted February 10, 2010 Lumooja showed you that way, have you tried it ? Quote -= Phenom II X4 965 3.4Ghz - ATI HD5870 - 6 GB DDR3 RAM - Windows 8 Pro 64x=- Website: http://www.flamewarestudios.com Link to comment Share on other sites More sharing options...
Canardia Posted February 10, 2010 Share Posted February 10, 2010 I think he wants to paint a surface with a material. Quote ■ Ryzen 9 ■ RX 6800M ■ 16GB ■ XF8 ■ Windows 11 ■ ■ Ultra ■ LE 2.5 ■ 3DWS 5.6 ■ Reaper ■ C/C++ ■ C# ■ Fortran 2008 ■ Story ■ ■ Homepage: https://canardia.com ■ Link to comment Share on other sites More sharing options...
Niosop Posted February 10, 2010 Share Posted February 10, 2010 PaintSurface might be what you want. Here's an example function that utilizes it (in Lua, but C would be basically the same): function makeUniqueMesh(ent, meshname) local orig_mesh = ent:FindChild(meshname) local new_mesh = CreateMesh(ent) for surface_index=1, orig_mesh:CountSurfaces() do local orig_surface = ent:FindChild(meshname):GetSurface(surface_index) local new_surface = CreateSurface(new_mesh) for i=1, orig_surface:CountVertices() do new_surface:AddVertex(orig_surface:GetVertexPosition(i-1), orig_surface:GetVertexNormal(i-1), orig_surface:GetVertexTexCoords(i-1,0)) end for i=1, orig_surface:CountTriangles() do new_surface:AddTriangle(orig_surface:TriangleVertex(i-1, 0), orig_surface:TriangleVertex(i-1, 1), orig_surface:TriangleVertex(i-1, 2)) end PaintSurface(new_surface, GetSurfaceMaterial(orig_surface)) end new_mesh:SetPosition(orig_mesh:GetPosition(1),1) new_mesh:SetRotation(orig_mesh:GetRotation(1),1) HideEntity(orig_mesh) UpdateMesh(new_mesh) return new_mesh end Quote Windows 7 x64 - Q6700 @ 2.66GHz - 4GB RAM - 8800 GTX ZBrush - Blender Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.