It is currently Sat Aug 22, 2020 1:44 pm


All times are UTC




Post new topic Reply to topic  [ 12 posts ]  Go to page Previous  1, 2
Author Message
 Post subject: Re: ogre <-> Polyvox (cg shader problems)
PostPosted: Sun Jun 03, 2012 7:14 pm 

Joined: Fri Jun 01, 2012 5:31 pm
Posts: 11
@david: i got it, texturing works :D

And about the atlas, i thought it would be easier.
The uv variable is just a float2, but for the atlas i need a float4
(i have to save these coordinates: startx, endx, starty, endy).
how can i change the shader to implement a float4 variable?


Top
Offline Profile  
Reply with quote  
 Post subject: Re: ogre <-> Polyvox (cg shader problems)
PostPosted: Mon Jun 04, 2012 12:19 pm 
Developer
User avatar

Joined: Sun May 04, 2008 6:35 pm
Posts: 1827
gamer8o4 wrote:
The uv variable is just a float2, but for the atlas i need a float4
(i have to save these coordinates: startx, endx, starty, endy).
how can i change the shader to implement a float4 variable?


The texture atlas is just a 2D texture which means you have to use a 2D position (float2) to sample it. The tex2D function can only sample one particular point in the texture, it cannot sample a 'range'.

Your startx, endx, starty, endy can indeed be stored in a float4 if you wish, and you can compute these values from the material id which PolyVox provides. You then need to combine these startx, endx, starty, endy with the texture coordinates for the particular fragment you are currently rendering, and this gives you the 2D position where you should sample the texture.

I don't have any code for this as I'm not using texture atlases myself, but if you search around this forum you might find something. But this isn't really a PolyVox issue, so you should also have a look elsewhere for any information you can find about implementing texture atlases. They are complex though. I'd still recommend you start by passing the textures through different texture units.


Top
Offline Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 12 posts ]  Go to page Previous  1, 2

All times are UTC


Who is online

Users browsing this forum: No registered users and 2 guests


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 post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created StylerBB.net