Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by Rod 1 · Apr 18, 2012 at 04:01 AM · texturetexture2dmipmapsmipmappacktextures

Is there a way to cap the max mipmap level of a generated texture?

Hi,

Does anyone know how to solve this problem?

alt text

I think it's related to this post: http://forum.unity3d.com/threads/889...-Mipmap-Levels

Is there a way to cap the max mipmap level of a generated texture atlas (using Texture2D.PackTextures())?

(from the picture above, mip level 5 would be the solution for this issue)

If not, is there a shader workaround?

TIA, R.

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image JasonBricco · Nov 08, 2014 at 11:35 PM 0
Share

This is quite old. But I've just now run into this problem and all I can find all over the internet is questions, and not answers. Is there a way to solve this with the newer versions of Unity? Or is it still practically impossible?

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Bunny83 · Nov 08, 2014 at 11:43 PM

You can calculate the mipmap levels yourself and use Texture2D.SetPixels32 to set each mipmap level manually. Keep in mind, like shown in the example, to pass "false" to the Apply method or Unity will calulate the mipmap levels manually.

I haven't use it yet, but i'm quite sure it should work if you only set level 0 to 5.

edit
I did some tests myself. Well it seems that you can either use mipmaps or not. If you use them they always to down to the lowest possible resolution. I'm not sure it this is a hardware thing (as the hardware does the mipmapping in the end) or a limitation of Unity. Anyways there seems to be no way to restrict mipmapping to a certain level. One solution could be a hybrid of using a custom shader + manipulated mipmap levels. You could set all higer mip levels to a certain key color (what isn't used by any texture) and detect that color in the fragment shader. In that case we know that our image is displayed only as a single pixel. Additionally you would set the vertex color of each tile to the wanted color. The vertex color is usually ignored but when the shader detects a miplevel above the limit it ignores the texture and uses the vertex color.

Of course this makes the management of your meshes more complicated and the shader is a bit more complicated but i think it should be doable.

Comment
Add comment · Show 3 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Bunny83 · Nov 08, 2014 at 11:49 PM 0
Share

I'm not sure how well that will work with anisotropic filtering since you can't set each anisotropic mipmap manually. It's possible that you can't use it at all. Well, just try it ;) $$anonymous$$aybe Unity creates the anisotropic mipmaps automatically out of mip0

avatar image JasonBricco · Nov 09, 2014 at 09:20 PM 0
Share

$$anonymous$$ips 6 to 10 require so few pixels that it's not possible to have each block separated in the texture - there would be blocks merged together. I wish I could just take mip 5 and write it to mips 6 to 10 so it all looks the same, but you need less pixels.

So what I really wish is that I could just say don't generate mips beyond mip 5.

avatar image Bunny83 · Nov 10, 2014 at 05:29 PM 0
Share

Hmm, it seems that At least OpenGL allows to set the max mipmap level with GL_TEXTURE_$$anonymous$$AX_LEVEL and GL_TEXTURE_$$anonymous$$AX_LOD. I guess that DirectX should have something similar. However i think Unity doesn't make use of those :|

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

6 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Texture2D.PackTextures - attempt to determine if texture was scaled 0 Answers

Texture mipmap distance 1 Answer

Don't load Mip 0 for certain textures based on a condition? 0 Answers

Kaiser mipmaps blurry in Unity 2020 1 Answer

PackTextures and DrawTexture 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges