Amplifying your potential.

Reflection rendering and AT2

Next-Gen Massive Virtual Texturing for Unity Pro
10 posts • Page 1 of 1

Reflection rendering and AT2

Postby ABorodyuk » Wed Mar 22, 2017 4:46 pm

Hello,
We are currently evaluating AT2 for our Architectural Visualization VR project and it looks and performs absolutely outstanding, except for one case. We have a custom semi-realtime mirror setup that is based on parallax corrected cubemapping. Cubemap is generated at runtime using a camera that renders one side at a time.
The problem is that the camera can't properly render megatextures, even though it has the same setup as the main camera, which renders everything perfectly. Textures are either blurred, split half blurred/half normal, or one side is simply broken. This effect only when using AT setup, if we disable the AT for that camera - everything renders perfectly.
Is there any way to overcome this issue?
I can see 2 different solutions:
1) A way to notify AT manager that it needs to stream maximum quality textures and the way for AT to notify our code that renders the cubemap sides that textures finished streaming in.
2) A way to tell AT that it doesn't need to set textures to 64x64, and keep the resolution higher, like 512x512, so we can use standard texturing for mirrors and AT for standard view.

Thanks in advance.
ABorodyuk
 
Posts: 7
Joined: Wed Mar 22, 2017 4:37 pm

Re: Reflection rendering and AT2

Postby Ricardo Teixeira » Wed Mar 22, 2017 5:14 pm

ABorodyuk wrote:Hello,
We are currently evaluating AT2 for our Architectural Visualization VR project and it looks and performs absolutely outstanding, except for one case. We have a custom semi-realtime mirror setup that is based on parallax corrected cubemapping. Cubemap is generated at runtime using a camera that renders one side at a time.
The problem is that the camera can't properly render megatextures, even though it has the same setup as the main camera, which renders everything perfectly. Textures are either blurred, split half blurred/half normal, or one side is simply broken. This effect only when using AT setup, if we disable the AT for that camera - everything renders perfectly.
Is there any way to overcome this issue?
I can see 2 different solutions:
1) A way to notify AT manager that it needs to stream maximum quality textures and the way for AT to notify our code that renders the cubemap sides that textures finished streaming in.
2) A way to tell AT that it doesn't need to set textures to 64x64, and keep the resolution higher, like 512x512, so we can use standard texturing for mirrors and AT for standard view.
Thanks in advance.


Hello,

Thank you for using AT2, we really appreciate it. We would be happy to help you solve any issues that you might be experiencing.

Are you using the Amplify Texture Camera component on the camera that generates the cubemap?

1. Future versions will allow you to pull pages manually, however, a camera with the AT2 component should provide similar results.
2. AT2 does not use the original textures, it streams directly from the Virtual Texture Asset file. If you force the texture resolution they will add to the final build size but will have to no effect on AT2.

We have actually done something similar to what you are describing for one of our old demos. I will discuss it with the AT2 developer and get back to you as soon as possible.

Thanks!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Ricardo Teixeira
 
Posts: 599
Joined: Fri Aug 09, 2013 2:26 pm

Re: Reflection rendering and AT2

Postby ABorodyuk » Wed Mar 22, 2017 5:20 pm

Ricardo Teixeira wrote:
ABorodyuk wrote:Hello,
We are currently evaluating AT2 for our Architectural Visualization VR project and it looks and performs absolutely outstanding, except for one case. We have a custom semi-realtime mirror setup that is based on parallax corrected cubemapping. Cubemap is generated at runtime using a camera that renders one side at a time.
The problem is that the camera can't properly render megatextures, even though it has the same setup as the main camera, which renders everything perfectly. Textures are either blurred, split half blurred/half normal, or one side is simply broken. This effect only when using AT setup, if we disable the AT for that camera - everything renders perfectly.
Is there any way to overcome this issue?
I can see 2 different solutions:
1) A way to notify AT manager that it needs to stream maximum quality textures and the way for AT to notify our code that renders the cubemap sides that textures finished streaming in.
2) A way to tell AT that it doesn't need to set textures to 64x64, and keep the resolution higher, like 512x512, so we can use standard texturing for mirrors and AT for standard view.
Thanks in advance.

Hello,

Thank you for using AT2, we really appreciate it. We would be happy to help you solve any issues that you might be experiencing.

Are you using the Amplify Texture Camera component on the camera that generates the cubemap?

1. Future versions will allow you to pull pages manually, however, a camera with the AT2 component should provide similar results.
2. AT2 does not use the original textures, it streams directly from the Virtual Texture Asset file. If you force the texture resolution they will add to the final build size but will have to no effect on AT2.

We have actually done something similar to what you are describing for one of our old demos. I will discuss it with the AT2 developer and get back to you as soon as possible.

Thanks!

Yes, we do have AT2 Camera component attached. If I delete it from the camera - cubemaps renders fine, but the textures, are obviously, low resolution. I'll be able to attach screenshots of the issue tommorow.
Do I understand it correctly - if the camera has no AT2 Camera component attached, all the materials that have AT shader applied will fallback to their default, non-AT variants and the 64x64 texture will be used? In this case, it is okay to contribute to build size, we have no limitations on this, is there a way to make AT2 not modify the texture importing settings, or tell it to set the texture size to something other then 64?
ABorodyuk
 
Posts: 7
Joined: Wed Mar 22, 2017 4:37 pm

Re: Reflection rendering and AT2

Postby Ricardo Teixeira » Wed Mar 22, 2017 7:13 pm

ABorodyuk wrote:Yes, we do have AT2 Camera component attached. If I delete it from the camera - cubemaps renders fine, but the textures, are obviously, low resolution. I'll be able to attach screenshots of the issue tommorow.


Just had a quick discussion with the AT2 developer and, unfortunately, our old demo used a Cubemap created in a external application. Can you elaborate on the method used to generate the cubemap? If you could share the actual script used directly to support@amplify.pt, we would be happy to examine it.

ABorodyuk wrote:Do I understand it correctly - if the camera has no AT2 Camera component attached, all the materials that have AT shader attached will fallback to their default, non-AT variants and the 64x64 texture will be used? In this case, it is okay to contribute to build size, we have no limitations on this, is there a way to make AT2 not modify the texture importing settings, or tell it to set the texture size to something other then 64?


Sadly, I don't think that it will be entirely possible without a few adjustments. There's no readily available way to prevent texture resize.

Looking forward to your reply.
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Ricardo Teixeira
 
Posts: 599
Joined: Fri Aug 09, 2013 2:26 pm

Re: Reflection rendering and AT2

Postby ABorodyuk » Wed Mar 22, 2017 7:39 pm

Ricardo Teixeira wrote:
ABorodyuk wrote:Yes, we do have AT2 Camera component attached. If I delete it from the camera - cubemaps renders fine, but the textures, are obviously, low resolution. I'll be able to attach screenshots of the issue tommorow.


Just had a quick discussion with the AT2 developer and, unfortunately, our old demo used a Cubemap created in a external application. Can you elaborate on the method used to generate the cubemap? If you could share the actual script used directly to support@amplify.pt, we would be happy to examine it.

I will post the code alongside with screenshots of the issue tomorrow, there's nothing special there.

Ricardo Teixeira wrote:
ABorodyuk wrote:Do I understand it correctly - if the camera has no AT2 Camera component attached, all the materials that have AT shader attached will fallback to their default, non-AT variants and the 64x64 texture will be used? In this case, it is okay to contribute to build size, we have no limitations on this, is there a way to make AT2 not modify the texture importing settings, or tell it to set the texture size to something other then 64?


Sadly, I don't think that it will be entirely possible without a few adjustments. There's no readily available way to prevent texture resize.

Looking forward to your reply.

Okay, does AT check the input texture on build? Or it's only done during scene save? I can write an editor script that crawls through all materials, looks up Amplify shaders, and sets the desired size of all textures that are assigned and then build the final exe file. I pretty much don't care how the reflections will look inside the editor, only final build matters.
ABorodyuk
 
Posts: 7
Joined: Wed Mar 22, 2017 4:37 pm

Re: Reflection rendering and AT2

Postby Ricardo Teixeira » Wed Mar 22, 2017 7:47 pm

ABorodyuk wrote:
Ricardo Teixeira wrote:
ABorodyuk wrote:Yes, we do have AT2 Camera component attached. If I delete it from the camera - cubemaps renders fine, but the textures, are obviously, low resolution. I'll be able to attach screenshots of the issue tommorow.


Just had a quick discussion with the AT2 developer and, unfortunately, our old demo used a Cubemap created in a external application. Can you elaborate on the method used to generate the cubemap? If you could share the actual script used directly to support@amplify.pt, we would be happy to examine it.

I will post the code alongside with screenshots of the issue tomorrow, there's nothing special there.

Ricardo Teixeira wrote:
ABorodyuk wrote:Do I understand it correctly - if the camera has no AT2 Camera component attached, all the materials that have AT shader attached will fallback to their default, non-AT variants and the 64x64 texture will be used? In this case, it is okay to contribute to build size, we have no limitations on this, is there a way to make AT2 not modify the texture importing settings, or tell it to set the texture size to something other then 64?


Sadly, I don't think that it will be entirely possible without a few adjustments. There's no readily available way to prevent texture resize.

Looking forward to your reply.

Okay, does AT check the input texture on build? Or it's only done during scene save? I can write an editor script that crawls through all materials, looks up Amplify shaders, and sets the desired size of all textures that are assigned and then build the final exe file. I pretty much don't care how the reflections will look inside the editor, only final build matters.


Looking forward to any additional information, this is actually something that we would love to improve in AT2, it could affect a few other uses.

Textures are changed every time the virtual texture is updated or rebuilt, the automated AT2 scene conversion tools also resizes them.
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Ricardo Teixeira
 
Posts: 599
Joined: Fri Aug 09, 2013 2:26 pm

Re: Reflection rendering and AT2

Postby ABorodyuk » Thu Mar 23, 2017 8:21 am

Ricardo Teixeira wrote:Looking forward to any additional information, this is actually something that we would love to improve in AT2, it could affect a few other uses.

Textures are changed every time the virtual texture is updated or rebuilt, the automated AT2 scene conversion tools also resizes them.

So, getting back to topic, unfortunately, a way 2 didn't work as expected, shaders do not fall back to non-AT ones, so currently we are stuck at what we have now.
The code that generates the cubemap looks like this:
Code: Select all
public class RealtimeReflection : MonoBehavior
    {
        public Camera TargetProbe;
        private RenderTexture _reflectionCubemap;
        private bool _updateQueued = false;
        private Coroutine _current;

        public void Start()
        {
            _reflectionCubemap = new RenderTexture(512, 512, 0);
            _reflectionCubemap.dimension = TextureDimension.Cube;
            UpdateReflection();
        }

        public void UpdateReflection()
        {
            if (_updateQueued)
            {
                StopCoroutine(_current);
                _updateQueued = false;
            }
            _current = StartCoroutine(UpdateReflectionImpl());
        }

        private float delay = 0.5f;

        private IEnumerator UpdateReflectionImpl()
        {
            TargetProbe.enabled = true;


            TargetProbe.transform.rotation = Quaternion.Euler(0, 0, 0);
            yield return new WaitForEndOfFrame();
            TargetProbe.RenderToCubemap(_reflectionCubemap, 1);
            yield return new WaitForEndOfFrame();


            TargetProbe.transform.rotation = Quaternion.Euler(0, -90, 0);
            yield return new WaitForEndOfFrame();
            TargetProbe.RenderToCubemap(_reflectionCubemap, 2);
            yield return new WaitForEndOfFrame();


            TargetProbe.transform.rotation = Quaternion.Euler(-90, 0, 0);
            yield return new WaitForEndOfFrame();
            TargetProbe.RenderToCubemap(_reflectionCubemap, 4);
            yield return new WaitForEndOfFrame();


            TargetProbe.transform.rotation = Quaternion.Euler(90, 0, 0);
            yield return new WaitForEndOfFrame();
            TargetProbe.RenderToCubemap(_reflectionCubemap, 8);
            yield return new WaitForEndOfFrame();

            TargetProbe.transform.rotation = Quaternion.Euler(0, -180, 0);
            yield return new WaitForEndOfFrame();
            TargetProbe.RenderToCubemap(_reflectionCubemap, 32);
       yield return new WaitForEndOfFrame();

            TargetProbe.enabled = false;
            _updateQueued = true;
        }


        public void Update()
        {
            if (_updateQueued)
            {
                this.GetComponent<MeshRenderer>().material.SetTexture("_Cube", _reflectionCubemap);
                _updateQueued = false;
            }
        }

One side of the cubemap is not not rendered, because it's not visible. This is intentional. Small optimization.
The result looks like this:
Image

You can see that the side that contains a toilet and bidet has it's geometry flipped, textures are blurred.
This is what camera looks like:
Image
If I disable Amplify Texture Camera component the result looks like this:
Image
As you can see, geometry flipping is gone and camera renders fine, except for blurred textures, obviously.

Some kind of workaround for this issue would be really nice. We are using Unity 5.5.2 and AT2 trial.
ABorodyuk
 
Posts: 7
Joined: Wed Mar 22, 2017 4:37 pm

Re: Reflection rendering and AT2

Postby Ricardo Teixeira » Thu Mar 23, 2017 11:03 am

ABorodyuk wrote:
Ricardo Teixeira wrote:Looking forward to any additional information, this is actually something that we would love to improve in AT2, it could affect a few other uses.

Textures are changed every time the virtual texture is updated or rebuilt, the automated AT2 scene conversion tools also resizes them.

So, getting back to topic, unfortunately, a way 2 didn't work as expected, shaders do not fall back to non-AT ones, so currently we are stuck at what we have now.
The code that generates the cubemap looks like this:
Code: Select all
public class RealtimeReflection : MonoBehavior
    {
        public Camera TargetProbe;
        private RenderTexture _reflectionCubemap;
        private bool _updateQueued = false;
        private Coroutine _current;

        public void Start()
        {
            _reflectionCubemap = new RenderTexture(512, 512, 0);
            _reflectionCubemap.dimension = TextureDimension.Cube;
            UpdateReflection();
        }

        public void UpdateReflection()
        {
            if (_updateQueued)
            {
                StopCoroutine(_current);
                _updateQueued = false;
            }
            _current = StartCoroutine(UpdateReflectionImpl());
        }

        private float delay = 0.5f;

        private IEnumerator UpdateReflectionImpl()
        {
            TargetProbe.enabled = true;


            TargetProbe.transform.rotation = Quaternion.Euler(0, 0, 0);
            yield return new WaitForEndOfFrame();
            TargetProbe.RenderToCubemap(_reflectionCubemap, 1);
            yield return new WaitForEndOfFrame();


            TargetProbe.transform.rotation = Quaternion.Euler(0, -90, 0);
            yield return new WaitForEndOfFrame();
            TargetProbe.RenderToCubemap(_reflectionCubemap, 2);
            yield return new WaitForEndOfFrame();


            TargetProbe.transform.rotation = Quaternion.Euler(-90, 0, 0);
            yield return new WaitForEndOfFrame();
            TargetProbe.RenderToCubemap(_reflectionCubemap, 4);
            yield return new WaitForEndOfFrame();


            TargetProbe.transform.rotation = Quaternion.Euler(90, 0, 0);
            yield return new WaitForEndOfFrame();
            TargetProbe.RenderToCubemap(_reflectionCubemap, 8);
            yield return new WaitForEndOfFrame();

            TargetProbe.transform.rotation = Quaternion.Euler(0, -180, 0);
            yield return new WaitForEndOfFrame();
            TargetProbe.RenderToCubemap(_reflectionCubemap, 32);
       yield return new WaitForEndOfFrame();

            TargetProbe.enabled = false;
            _updateQueued = true;
        }


        public void Update()
        {
            if (_updateQueued)
            {
                this.GetComponent<MeshRenderer>().material.SetTexture("_Cube", _reflectionCubemap);
                _updateQueued = false;
            }
        }

One side of the cubemap is not not rendered, because it's not visible. This is intentional. Small optimization.
The result looks like this:
Image

You can see that the side that contains a toilet and bidet has it's geometry flipped, textures are blurred.
This is what camera looks like:
Image
If I disable Amplify Texture Camera component the result looks like this:
Image
As you can see, geometry flipping is gone and camera renders fine, except for blurred textures, obviously.

Some kind of workaround for this issue would be really nice. We are using Unity 5.5.2 and AT2 trial.


Hello,

We will need to make a few adjustments on our side. I will register your request and contact you as soon as the AT2 developer has a chance to tackle it.

Apologies for the inconvenience.
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Ricardo Teixeira
 
Posts: 599
Joined: Fri Aug 09, 2013 2:26 pm

Re: Reflection rendering and AT2

Postby ABorodyuk » Thu Mar 23, 2017 11:29 am

Ricardo Teixeira wrote:Hello,

We will need to make a few adjustments on our side. I will register your request and contact you as soon as the AT2 developer has a chance to tackle it.

Apologies for the inconvenience.

I have subscribed to this topic. Please let me know here or via PM when you have any info. Thank you.
ABorodyuk
 
Posts: 7
Joined: Wed Mar 22, 2017 4:37 pm

Re: Reflection rendering and AT2

Postby Ricardo Teixeira » Thu Mar 23, 2017 12:19 pm

ABorodyuk wrote:
Ricardo Teixeira wrote:Hello,

We will need to make a few adjustments on our side. I will register your request and contact you as soon as the AT2 developer has a chance to tackle it.

Apologies for the inconvenience.

I have subscribed to this topic. Please let me know here or via PM when you have any info. Thank you.


Will do, thanks!
Sales & Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
User avatar
Ricardo Teixeira
 
Posts: 599
Joined: Fri Aug 09, 2013 2:26 pm


10 posts • Page 1 of 1

Return to Amplify Texture 2 - Development Builds

Who is online

Users browsing this forum: No registered users and 1 guest

cron