Jump to content

Using MegaTextures with Unity?


Recommended Posts

Hi everyone!

While I was looking for something totally different, I came across this website.

It's a plugin allowing the creation of virtual textures in Unity, using the Carmack's MegaTexture idea. According to the author, it can be used to create textures up to 64 Terapixels and stream them at runtime.

I'm wondering if a plugin like this can be used with KSP, to load better textures for planets, and eventualy load textures dynamically, to reduce RAM consumption.

This plugin is not free, but it comes with a trial version (didn't try it yet). I need confirmation (or at least some hints) from someone who knows Unity (and KSP's code) better than I do: According to the website, all you have to do is to create your texture, load it from an asset, and apply a script to the scene's camera. If it's even possible to apply this, can it be done at runtime?

Link to comment
Share on other sites

A quick read of their doc show that you need to add a component to the scene, and doing so at runtime can range from trivial to impossible (depending of the component). Furthermore their spec show you can only have 16 megatexture per scene which is quite limited, and they recommends Unity 5 (only in beta for paying customers atm).

I would need some testing to be sure, but I have serious doubt a plugin could use it. And that's even before looking at the price tag ^^

Link to comment
Share on other sites

The price is the main reason this plugin will never be in a mod. I'm more interested in the "proof of concept". I think the component could be created with the Editor and imported in the scene, but textures needs to be converted to a specific format.

In the tutorial, it's done with a tool in the Editor. Even if I manage somehow to create the Texture Manager and add the script to the camera, I don't see how I could call this tool at runtime. Or maybe this must be done only once, in the Editor? I'll take a closer look at this ASAP.

Also, somehow I forgot KSP has moons too... That 16 textures limit could be a problem... Let's keep those textures for planets for now... (a workaround could be to store several textures in one gigantic texture, but this will bring many other problems)

Thanks for answering!

Link to comment
Share on other sites

I think the component could be created with the Editor and imported in the scene, but textures needs to be converted to a specific format.

The only way I know to do that is with asset bundle and it require Unity Pro.

Link to comment
Share on other sites

I can't even test this: importing the trial package makes my Editor crash...

But I think you're right. It won't be done with a plugin, I'm not even sure it can be done at scene creation at lower level: after some reading, it appear that MegaTextures (or virtual texturing) can have a huge impact on RAM and VRAM with large landscapes (like KSP's)... Definitely not what the game needs at the moment...

The plugin is quite young, though, maybe virtual texturing will be easier and more flexible in future versions of Unity (I believe DX11.2 has some functions to handle this, Ultra-HD textures are just a matter of time).

Thanks again for the quick answers, at least I didn't spent too much time on this.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...