OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

Mapping texture coordinates to a portion of a large (.obj) model


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
ijwolf8
Newbie


Joined: 25 Oct 2018
Posts: 1

PostPosted: Thu Oct 25, 2018 8:11 pm    Post subject:
Mapping texture coordinates to a portion of a large (.obj) model
Reply with quote

Hello all,

I am new to OSG, and I am having some difficulty understanding the steps required to complete this task.

Basically, I want to map an image to a portion of a .obj file I am loading in as a Node. I have the 3D position and indices of four points that I would like to use as UV coordinates for an incoming image.

My primary issue is that the .obj doesn't have texture coordinates in the first place. So I figured I could add the only 4 points I care about manually, and assign them as UV coordinates.

Is this possible? Or do you always need a 1 to 1 mapping for texture coordinates? In pseudo/osg inspired code, I'd image it would look something like the following.

Say I had a Vec3 array of 4 points that sit on the surface of a model called points_of_concern, and a uv_array that is just <0,0>, <0,1>, etc.

Code:

...
<Node> myNode= readNodeFile("model.obj");
Vec3 points_of_concern=[<2.3, 3.2, 3.1>, ....];
Vec2 uv_array= [<0,0>, <0,1>...];

myNode->setTexCoordinates(points_of_concern);
Texture2D myTex = readImageFile("image.png");
myTex->setTextureCoordinates(uv_array);

myNode->setTexture(myTex);


It seems like a simple task, but I did a lot of searching without any luck!

Thanks for your time!

Regards,
Isaac[/code]
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts Switch between primitive and model charlietan789 General 2 Mon Nov 12, 2018 2:25 am View latest post
No new posts reflection on mesh texture nonnenmacher General 2 Tue Nov 06, 2018 7:58 pm View latest post
No new posts Rend to Texture Once GuiYe General 1 Sun Aug 26, 2018 7:31 am View latest post
No new posts Model matrix kullboys General 0 Tue Aug 21, 2018 7:10 am View latest post
No new posts Can't share Texture among several tex... mp3butcher General 1 Fri Aug 17, 2018 11:06 pm View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP