Jump to content

  • Log In with Google      Sign In   
  • Create Account

Setting mipmap level ?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 vNeeki   Members   -  Reputation: 194

Like
0Likes
Like

Posted 29 March 2012 - 08:08 PM

Hi

I would like to port my opengl renderer to D3D in order to be able to switch between them at runtime , although i hit a wall when attempting to set the mipmap level!

In opengl you just pass in the mipmap level in glXXTexImage2D functions , but D3D texture loader seems to not allow such arguments.

..So i would like to ask if that's possible in D3D(10,11) and if not ...is there any workaround ?

Thanks for looking.

Sponsor:

#2 Slig Commando   Members   -  Reputation: 334

Like
0Likes
Like

Posted 29 March 2012 - 08:15 PM

What is your method for recreating your textures in direct3d?

#3 Hornsj3   Members   -  Reputation: 191

Like
1Likes
Like

Posted 29 March 2012 - 08:25 PM

Assuming you have created a texture2d object with mip maps in Directx11, you can create a shader resource view which contains one or all mip levels.

If you create it with all mip levels, you can choose the mip level you want to sample in your shader. Not to confuse you further, but the method is actually Load, not sample. Sample uses a sampler, which I don't think can select mip levels directly ( you have to create a shader resource view with a single mip if you want to sample ... I think). If you have a multiple mip-map level resource you can use load to get the value at (x,y,z) where z is the mip level.

#4 vNeeki   Members   -  Reputation: 194

Like
0Likes
Like

Posted 29 March 2012 - 08:50 PM

Assuming you have created a texture2d object with mip maps in Directx11, you can create a shader resource view which contains one or all mip levels.

If you create it with all mip levels, you can choose the mip level you want to sample in your shader. Not to confuse you further, but the method is actually Load, not sample. Sample uses a sampler, which I don't think can select mip levels directly ( you have to create a shader resource view with a single mip if you want to sample ... I think). If you have a multiple mip-map level resource you can use load to get the value at (x,y,z) where z is the mip level.


Waaah so its impossible to avoid writing shaders Posted Image
This is a no-go for me then.I can't mess my source base just to support directx rendering Posted Image

@Slig Commando
That's the problem , i haven't displayed anything on screen yet since i wasn't able to figure out which was the proper method for loading a mipmapped texture.

#5 Hornsj3   Members   -  Reputation: 191

Like
0Likes
Like

Posted 29 March 2012 - 09:24 PM

You can't do anything in DX11 without writing a shader. There's no fixed function.

#6 MJP   Moderators   -  Reputation: 11372

Like
0Likes
Like

Posted 30 March 2012 - 01:28 AM

If you create it with all mip levels, you can choose the mip level you want to sample in your shader. Not to confuse you further, but the method is actually Load, not sample. Sample uses a sampler, which I don't think can select mip levels directly ( you have to create a shader resource view with a single mip if you want to sample ... I think). If you have a multiple mip-map level resource you can use load to get the value at (x,y,z) where z is the mip level.


You can use SampleLevel if you want to explicitly set a mip level (or you can pick a value in between two mip levels and filter between them)

#7 Hornsj3   Members   -  Reputation: 191

Like
0Likes
Like

Posted 30 March 2012 - 06:56 AM

You can use SampleLevel if you want to explicitly set a mip level (or you can pick a value in between two mip levels and filter between them)


Oh Nice.




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS