Jump to content
  • Advertisement
Sign in to follow this  
Lykaios

Optimizing pieces of a model's texture

This topic is 3982 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The game I'm creating uses an eyetracking technology. The professor I'm working with wants me to investigate the following: Is there a way to only display an area around where the player is looking in higher definition? For example, say you're looking at a cliff. The area being looked at would have high-resolution texture applied to that part, while everywhere else would have a lower resolution. I know I could make it so that the entire texture of a model being looked at is higher resolution, but would there be a way to do that to only a part of the texture? I'm just not sure where to start investigating this. Thanks, Lykaios

Share this post


Link to post
Share on other sites
Advertisement
Google for "depth of field", which is a bit like what you're talking about. The way this is often done in games is as a post-processing effect; you first render the whole scene at high resolution, then selectively blur based on Z-buffer values (the further the Z value is from your focal point, the more blur). This simulates how the eye or a camera focuses on an object.

Share this post


Link to post
Share on other sites
I guess your tracking device just gives you 2d coordinates, right?

In that case I suggest that you:
* Render the scene to a texture using high details.
* Blur this texture into another texture.
* Create a texture with a greyscale mask (more or less a white smooth ball).
* Render to backbuffer having the three textures above and blend between the blurred and non blurred version of the scene depeneding on the mask texture.

Setup the UV's of the mask so that the center of the texture is at the tracking points, make sure that texel fetching is clamped to the edges of the mask texture.

Mockup in photo shop:

Original scene rendered to texture:
Original scene rendered to texture

Blurred version of the original:
Blurred version of the original<br>

Mask texture, could vary depending on the size and smoothness of the focal point desired:
Mask texture

Mask placed a desired spot by updating UV's, clamping ensures that we cover the whole screen:
Mask placed a desired spot by updating UV's

Final image, blending orignal and blurred depending on mask.
Final image

Share this post


Link to post
Share on other sites
Judging from the Title of the Thread I would assume the OP actually wants to optimize rendering by just rendering part of the image at high detail. The above mentioned post-processing method only costs more (and if the view tracking works correctly, no visible effect at all.).

Share this post


Link to post
Share on other sites
I guess you could manually select mipmap-levels depending on a certain "focus-factor" or similar, would that do the trick?

Share this post


Link to post
Share on other sites
** Just to clarify so you don't have to read my entire long-winded post, I'm not trying to blur textures outside of player's focus, I'm trying to save resources by having the textures outside focus be lower res**


Quote:
Original post by Rasmadrak
I guess you could manually select mipmap-levels depending on a certain "focus-factor" or similar, would that do the trick?


I think this is the direction I'm going to have to go in, as this effect I'm wanting would be done in real time during gameplay.

The problem is, this is just something I'm cooking up for our grant pitch. I'm no graphics guy, and I'm wondering if this is outta my league.

I'm using OGRE, and I know that with OGRE the mip-map settings are done within the materials themselves, not in runtime code.

What seems to be the case is that I'm not going to be able to mip-map bits and pieces of a model's texture (as in the above suggestion showing the mountains), instead it appears I will have to settle for entire models.

In other words (boy is this hard to explain in text): Whatever models are within a certain area around the player's view will have higher resolution textures, all the rest will be lower res.

I'm wondering if this will actually save any resources. My boss wants me to do it anyways, but I'm not sure on that point.

Okay, as long as it sounds like I have this straight, can anyone point me to a good explanation of mip-mapping? I can't find anything in the OGRE documentation.

Or even better, could someone hash out with me where I would want to get started on coding this specialized mip-mapping?

ugh, I'm so out of my element.

Regardless, thanks for all the helpful responses guys, I really appreciate it.
~Eric

Share this post


Link to post
Share on other sites
Well, you will need shader programming for selecting mip levels manually

Thread on selecting mipmap levels

You could bias the mip level depending on how far the tracked point is from the screen position of the current fragment.

I am unsure though, if this will help improve framerate at all, probably not.

Share this post


Link to post
Share on other sites
At what level will I be programming the shader? I mean, I am using OGRE, will that have shader libraries/settings that I can modify?

Also, since the general feedback I'm getting is that this won't help framerate overly much, I'm wondering if any of this will:

Taking the following off of models not in focus:

Normal Mapping
Bump Mapping (is this even used anymore)
Anti-Aliasing (is this possible?)

Basically, this isn't super important to the game itself, but as part of the pitch to the people we're getting the grant from, this kind of eye candy will be invaluable.

According to my boss...

Thanks for the help guys,
~Lykaios

Share this post


Link to post
Share on other sites
I think you will have to write your own GLSL/HLSL/Cg shaders (I think Ogre uses Cg shaders)

Normal mapping isn't that costly but you could of course deactivate it if the aforementioned bias passes a certain threshold. Bump mapping is pretty much the same (only if it is implemented in a shader of course). Antialiasing on the other hand is usually implemented as MSAA which you cannot deactivate "locally".

Share this post


Link to post
Share on other sites
Well, you could still use the above method (Referencing the screen blur technique) to optimize performance.

Instead of rendering the screen to the back-buffer as per usual, render it to a smaller render target and then stretch that over the screen (Maybe after running a quick and cheap blur over it to improve the image quality). Then, using a scissor region, render a high-res version of the scene to only the area that you intend to show in high detail. Use the same masking approach to make sure it doesn't have a noticeable seam at the edges and you should be good to go.

Main reason why this should give you a performance boost is because of the dramatically reduced pixel processing. If your blurry version of the back-buffer was a quarter of the size of the screen resolution, that's almost a 4 times saving on the amount of pixels you need to process, and will make a huge difference on shader-heavy scenes.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!