RTT as HlmsPbs detail map

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


DainiusVaiksnys
Gnoblar
Posts: 20
Joined: Wed Apr 01, 2015 3:03 pm
x 2

RTT as HlmsPbs detail map

Post by DainiusVaiksnys »

I am trying to assign RTT as a detail map for Hlms datablock. How should I create this texture?
I tried to create it as always (1.8 way):

Code: Select all

dRtt = Ogre::TextureManager::getSingletonPtr()->createManual(
            "dRtt",
            Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
            Ogre::TEX_TYPE_2D,
            1024,
            1024,
            0,
            Ogre::PF_R8G8B8A8,
            Ogre::TU_RENDERTARGET
        );
Then I create default workspace to render something (just to test if it works):

Code: Select all

const Ogre::IdString workspaceName( "TestingRTT" );
mGraphicsSystem->getRoot()->getCompositorManager2()->createBasicWorkspaceDef(workspaceName, Ogre::ColourValue::Red);
dWorkspace = mGraphicsSystem->getRoot()->getCompositorManager2()
    ->addWorkspace(sceneManager, dRtt->getBuffer()->getRenderTarget(), mGraphicsSystem->getCamera(), workspaceName, true);
Then finally I try setting detail map 0 on "Marble" datablock:

Code: Select all

datablock->setTexture(Ogre::PBSM_DETAIL0, 0, dRtt);
Unfortunatelly this does not work. The problem is that Hlms expects TEX_TYPE_2D_ARRAY texture.

Code: Select all

dRtt = Ogre::TextureManager::getSingletonPtr()->createManual(
            "dRtt",
            Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
            Ogre::TEX_TYPE_2D_ARRAY,
            1024,
            1024,
            1,
            0,
            Ogre::PF_R8G8B8A8,
            Ogre::TU_RENDERTARGET
        );
If I try to create it like this I get "OpenGL:error(high) 1280: GL_INVALID_ENUM error generated. <textarget> enum is invalid; expected GL_TEXTURE_3D or GL_TEXTURE_2D_MULTISAMPLE_ARRAY."
I am using GL3Plus Render System.
How should I create a render target as texture array?
PS: I need to render to this RTT every frame.
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: RTT as HlmsPbs detail map

Post by xrgo »

I am having a related problem
Besides of having a RTT (for mirrors or screens), sometimes we need to modify the texture by code, for instance to write a text on it (http://www.ogre3d.org/tikiwiki/tiki-ind ... on+texture), or put a video, or a webcam stream.
I don't know much about the subject but being able to use a simple old school texture sometimes should solve this problems, but it seems that its not possible. This wont work:

Code: Select all

    Ogre::TexturePtr texture = Ogre::TextureManager::getSingletonPtr()->getByName("myTexture.jpg");
    datablock->setTexture( Ogre::PBSM_DIFFUSE, 0, texture );
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5298
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1279
Contact:

Re: RTT as HlmsPbs detail map

Post by dark_sylinc »

PBS expects a TextureArray and that's why it's not working.

Perhaps if the RTT is created as a texture array of one slice, you could workaround the problem. This is probably the most useful approach.
Of if you copy the data from the RTT to a texture array.

Another solution would be to modify the PBS module to support non-array textures, although that can be quite difficult to support.
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: RTT as HlmsPbs detail map

Post by xrgo »

DainiusVaiksnys wrote:Unfortunatelly this does not work. The problem is that Hlms expects TEX_TYPE_2D_ARRAY texture.

Code: Select all

dRtt = Ogre::TextureManager::getSingletonPtr()->createManual(
            "dRtt",
            Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
            Ogre::TEX_TYPE_2D_ARRAY,
            1024,
            1024,
            1,
            0,
            Ogre::PF_R8G8B8A8,
            Ogre::TU_RENDERTARGET
        );
:( If I try to create a texture array I get this error:
terminate called after throwing an instance of 'Ogre::InvalidParametersException'
what(): OGRE EXCEPTION(2:InvalidParametersException): Framebuffer incomplete or other FBO status error in GL3PlusFrameBufferObject::initialise at /home/sergio/ogre/RenderSystems/GL3Plus/src/OgreGL3PlusFrameBufferObject.cpp (line 239)
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: RTT as HlmsPbs detail map

Post by xrgo »

I just tested using Unlit and it works, I just made a mirror :P
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5298
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1279
Contact:

Re: RTT as HlmsPbs detail map

Post by dark_sylinc »

Yes, Unlit does support non array textures; I needed that feature and turned out it was quite easy to add support for it unlike PBS; mostly because all textures are of the same kind (diffuse maps blended together), instead of being of different nature (normal maps, diffuse, detail, reflection) and texture arrays are key to performance where is most needed in PBS; and not so much in Unlit.
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: RTT as HlmsPbs detail map

Post by xrgo »

thank you very much, that makes total sense
DainiusVaiksnys
Gnoblar
Posts: 20
Joined: Wed Apr 01, 2015 3:03 pm
x 2

Re: RTT as HlmsPbs detail map

Post by DainiusVaiksnys »

Made a fix to a GL3Plus Render system. It is now possible to create render target as texture array. Will submit PR later today. There will be no problem using custom RTT with HlmsPbs datablocks.
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: RTT as HlmsPbs detail map

Post by xrgo »

Hello! I want to render a cubemap in runtime and use it as Ogre::PBSM_REFLECTION, the thing is I need my render target to be "Ogre::TEX_TYPE_CUBE_MAP" no "Ogre::TEX_TYPE_2D_ARRAY" =(
is that even possible??

EDIT: apparently it works using TEX_TYPE_CUBE_MAP, I was doing something wrong, anyways I am just getting one face rendered ok, I am using a workspace with camera_cubemap_reorient yes

EDIT2: this is myWorkspace:

Code: Select all

//CUBEMAP WORKSPACE for enviroment map
//+X'. '-X', '+Y', '-Y', '+Z', and '-Z
compositor_node cubeMapRenderNode_0
{
	in 0 render

	target render slice +X
	{
		pass clear
		{
			colour_value 0 0 0 1
		}

		pass render_scene
		{
			overlays off
			camera_cubemap_reorient yes
		}
	}
}
compositor_node cubeMapRenderNode_1
{
	in 0 render

	target render slice -X
	{
		pass clear
		{
			colour_value 0 0 0 1
		}

		pass render_scene
		{
			overlays off
			camera_cubemap_reorient yes
		}
	}
}
compositor_node cubeMapRenderNode_2
{
	in 0 render

	target render slice +Y
	{
		pass clear
		{
			colour_value 0 0 0 1
		}

		pass render_scene
		{
			overlays off
			camera_cubemap_reorient yes
		}
	}
}
compositor_node cubeMapRenderNode_3
{
	in 0 render

	target render slice -Y
	{
		pass clear
		{
			colour_value 0 0 0 1
		}

		pass render_scene
		{
			overlays off
			camera_cubemap_reorient yes
		}
	}
}
compositor_node cubeMapRenderNode_4
{
	in 0 render

	target render slice +Z
	{
		pass clear
		{
			colour_value 0 0 0 1
		}

		pass render_scene
		{
			overlays off
			camera_cubemap_reorient yes
		}
	}
}
compositor_node cubeMapRenderNode_5
{
	in 0 render

	target render slice -Z
	{
		pass clear
		{
			colour_value 0 0 0 1
		}

		pass render_scene
		{
			overlays off
			camera_cubemap_reorient yes
		}
	}
}

//CubeMap Workspace
workspace WorkspaceCubeMap_0
{
	connect_output cubeMapRenderNode_0 0
}
workspace WorkspaceCubeMap_1
{
	connect_output cubeMapRenderNode_1 0
}
workspace WorkspaceCubeMap_2
{
	connect_output cubeMapRenderNode_2 0
}
workspace WorkspaceCubeMap_3
{
	connect_output cubeMapRenderNode_3 0
}
workspace WorkspaceCubeMap_4
{
	connect_output cubeMapRenderNode_4 0
}
workspace WorkspaceCubeMap_5
{
	connect_output cubeMapRenderNode_4 0
}
And this is my code:

Code: Select all

void yEngine::initEnvCubeMap(){

    Ogre::Camera* envCam = sceneManager->createCamera( "envCubeMapCamera" );
    envCam->setFOVy(Ogre::Degree(90));
    envCam->setAspectRatio(1);
    envCam->setFixedYawAxis(false);
    envCam->setNearClipDistance(0.01);
    envCam->setFarClipDistance(mainCamera->getFarClipDistance());

    envCubeMap = Ogre::TextureManager::getSingletonPtr()->createManual(
                "envCubeMap",
                Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
                Ogre::TEX_TYPE_CUBE_MAP,
                1024,
                1024,
                0,  //0 for now, just for testing
                Ogre::PF_R8G8B8,
                Ogre::TU_RENDERTARGET,
                0,
                true
            );

    for(int i=0; i<6; i++){
        root->getCompositorManager2()->addWorkspace(sceneManager, envCubeMap->getBuffer(i)->getRenderTarget(), envCam, "WorkspaceCubeMap_"+Ogre::StringConverter::toString(i), true);
    }

}
Is there a way to reuse more code??? see the workspace is basically the same 6 times... and still I am getting the same image on all six faces =(, it seems that "camera_cubemap_reorient yes" or the "slice" parameters is not working, am I doing something wrong?
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: RTT as HlmsPbs detail map

Post by xrgo »

I soved my problem using old school method, manually rotating the camera in "preRenderTargetUpdate"m and its using one node/workspace definition
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: RTT as HlmsPbs detail map

Post by xrgo »

The only problem now is how to generate the mipmaps for the rtt =/

EDIT: I am still having trouble with the mipmaps, I tried this:

Code: Select all

    Ogre::TexturePtr envCubeMap;

    envCubeMap = Ogre::TextureManager::getSingletonPtr()->createManual(
                "envCubeMap",
                Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,
                Ogre::TEX_TYPE_CUBE_MAP,
                512,
                512,
                9,
                Ogre::PF_R8G8B8,
                Ogre::TU_RENDERTARGET,
                0,
                true
            );

        Ogre::v1::HardwarePixelBufferSharedPtr readbuffer;
    readbuffer = envCubeMap->getBuffer(0, 0);
    readbuffer->lock(Ogre::v1::HardwareBuffer::HBL_NORMAL );
    const Ogre::PixelBox &readrefpb = readbuffer->getCurrentLock();
    uchar *readrefdata = static_cast<uchar*>(readrefpb.data);

    Ogre::Image img;
    img = img.loadDynamicImage (readrefdata, envCubeMap->getWidth(), envCubeMap->getHeight(), 0, envCubeMap->getFormat(),false,6,9);
    envCubeMap->convertToImage(img);
    readbuffer->unlock();
    img.generateMipmaps(true, Ogre::Image::FILTER_GAUSSIAN);
    img.save("./cubeMap.dds");

    envCubeMap->loadImage(img);
"generateMipmaps" returns true, but the saved file "test.dds" dont have any mipmaps when I open it in Gimp, and "envCubeMap" when used as reflection looks like 0 rough (so no mipmaps)
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5298
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1279
Contact:

Re: RTT as HlmsPbs detail map

Post by dark_sylinc »

xrgo wrote:Is there a way to reuse more code??? see the workspace is basically the same 6 times... and still I am getting the same image on all six faces =(, it seems that "camera_cubemap_reorient yes" or the "slice" parameters is not working, am I doing something wrong?
See the 2.0's old sample on CubeMapping. The code works. Edit: Your definition contains the word "slice" which is not a valid keyword. That must be why the camera reorient isn't working. Just write +X directly, just as in the example I'm posting

This is the compositor script used:

Code: Select all

abstract target cubemap_target
{
	pass clear
	{
		colour_value 0 0 0 1
	}

	pass render_scene
	{
		//Filter stuff that shouldn't be reflected (vampires?)
		visibility_mask		0x00000004
		overlays			off
		camera_cubemap_reorient true
	}
}

compositor_node CubemapRendererNode
{
	in 0 cubemap

	target cubemap +X : cubemap_target { }
	target cubemap -X : cubemap_target { }
	target cubemap +Y : cubemap_target { }
	target cubemap -Y : cubemap_target { }
	target cubemap +Z : cubemap_target { }
	target cubemap -Z : cubemap_target { }
}
And the relevant C++ code:

Code: Select all

// create the camera used to render to our cubemap
mCubeCamera = mSceneMgr->createCamera("CubeMapCamera", true, true);
mCubeCamera->setFOVy(Degree(90));
mCubeCamera->setAspectRatio(1);
mCubeCamera->setFixedYawAxis(false);
mCubeCamera->setNearClipDistance(5);

//The default far clip distance is way too big for a cubemap-capable camara, which prevents
//Ogre from better culling and prioritizing lights in a forward renderer.
//TODO: Improve the Sky algorithm so that we don't need to use this absurd high number
mCubeCamera->setFarClipDistance( /*100*/10000 );

// create our dynamic cube map texture
TexturePtr tex = TextureManager::getSingleton().createManual("dyncubemap",
    ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, TEX_TYPE_CUBE_MAP, 512, 512, 0, PF_R8G8B8, TU_RENDERTARGET);

CompositorManager2 *compositorManager = mRoot->getCompositorManager2();

const Ogre::IdString workspaceName( "CompositorSampleCubemap_cubemap" );
if( !compositorManager->hasWorkspaceDefinition( workspaceName ) )
{
    CompositorWorkspaceDef *workspaceDef = compositorManager->addWorkspaceDefinition(
                                                                            workspaceName );
    //"CubemapRendererNode" has been defined in scripts.
    //Very handy (as it 99% the same for everything)
    workspaceDef->connectOutput( "CubemapRendererNode", 0 );
}

CompositorChannel channel;
channel.target = tex->getBuffer(0)->getRenderTarget(); //Any of the render targets will do
channel.textures.push_back( tex );
mCubemapWorkspace = compositorManager->addWorkspace( mSceneMgr, channel, mCubeCamera,
                                                     workspaceName, false );
EDIT: I am still having trouble with the mipmaps, I tried this:
Mipmaps always give headaches. I suggest you dump the image's mipmaps as single PNGs. I'm not particularly trusting neither the DDS codec nor loadImage. Mipmaps might be getting generated but not uploaded nor saved to disk.
If that's not it then I suggest to step into generateMipmaps to see if there's anything suspicious about the code flow.
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: RTT as HlmsPbs detail map

Post by xrgo »

dark_sylinc wrote:I suggest you dump the image's mipmaps as single PNGs.
Thank you very much!
I have my pngs, but how do I load them as a Cubemap using the HlmsTextureManager? I have to follow the sufix rule (_bk, _dn, _fr)??
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5298
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1279
Contact:

Re: RTT as HlmsPbs detail map

Post by dark_sylinc »

xrgo wrote:Thank you very much!
I have my pngs, but how do I load them as a Cubemap using the HlmsTextureManager? I have to follow the sufix rule (_bk, _dn, _fr)??
I'll take it that it worked then (the mipmaps do come out correctly as PNGs).
I was just suggesting this to rule both a defective codec and the uploading. That's really what needs fixing.

Is this for realtime or not realtime cubemap rendering?
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: RTT as HlmsPbs detail map

Post by xrgo »

dark_sylinc wrote:I'll take it that it worked then (the mipmaps do come out correctly as PNGs).?
actually I dont know, not sure how to verify that, but anyways everything is working perfect now, I am saving and loading my pngs like this:

Code: Select all

std::vector<std::string> sufix;
    sufix.push_back("rt");
    sufix.push_back("lf");
    sufix.push_back("up");
    sufix.push_back("dn");
    sufix.push_back("fr");
    sufix.push_back("bk");

    //envCubeMap is the cube texture that I need to save
    for(int i=0; i<6; i++){
        envCubeMap->getBuffer(i)->getRenderTarget()->writeContentsToFile("./media/textures/cubemap/cubemap_"+sufix.at(i)+".png");
    }

    envCubeMap->unload();

    Ogre::TexturePtr cubemap = Ogre::TextureManager::getSingletonPtr()->load("cubemap.png",Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,Ogre::TEX_TYPE_CUBE_MAP,10,1,false,Ogre::PF_R8G8B8,true);

    //Apply to every pbs datablock
    Ogre::Hlms::HlmsDatablockMap::const_iterator itor = hlmsPbs->getDatablockMap().begin();
    Ogre::Hlms::HlmsDatablockMap::const_iterator end  = hlmsPbs->getDatablockMap().end();
    while( itor != end )
    {
        Ogre::HlmsPbsDatablock *datablockPbs = static_cast<Ogre::HlmsPbsDatablock*>(itor->second.datablock);
        datablockPbs->setTexture( Ogre::PBSM_REFLECTION, 0, cubemap );
        ++itor;
    }
And mipmaps are working fine now, since at loading I specify numMipmaps
dark_sylinc wrote:Is this for realtime or not realtime cubemap rendering?
not realtime, so saving them to png files works for me =)

Thank you!!
User avatar
miki3d
Halfling
Posts: 56
Joined: Wed Jul 18, 2012 1:30 pm
Location: Italy
x 4

Re: RTT as HlmsPbs detail map

Post by miki3d »

Hi Guys!

We're trying to have a realtime cubemap and we're facing the no-mip issues

Sphere with roughness = 0
Image

Sphere with roughness > 0
Image

Since the ambient light comes from a lower mip, we've all no-lit parts black

Code: Select all

	m_dynCubeRTT = Ogre::TextureManager::getSingleton().createManual("ReflectionRTT",
			Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, Ogre::TEX_TYPE_CUBE_MAP,
			512, 512, Ogre::MIP_UNLIMITED, Ogre::PF_FLOAT16_RGB, Ogre::TU_RENDERTARGET|Ogre::TU_AUTOMIPMAP, nullptr, true);

Any chance/idea?
Image
Co-Founder and Design Director at VaeVictis
Current project Racecraft
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5298
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1279
Contact:

Re: RTT as HlmsPbs detail map

Post by dark_sylinc »

That picture looks beautiful!

As for the problem: I'm afraid AUTOMIPMAP and RENDERTARGET aren't working together. I guess it should be fixed promptly.
The main issue was that the feature never worked really well thanks to DX9 semi-awkwardness and GL's full awkwardness (never works right).
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: RTT as HlmsPbs detail map

Post by xrgo »

that's looking awesome :D
I am interested in that feature too =)
al2950
OGRE Expert User
OGRE Expert User
Posts: 1227
Joined: Thu Dec 11, 2008 7:56 pm
Location: Bristol, UK
x 157

Re: RTT as HlmsPbs detail map

Post by al2950 »

dark_sylinc wrote:That picture looks beautiful!

As for the problem: I'm afraid AUTOMIPMAP and RENDERTARGET aren't working together. I guess it should be fixed promptly.
The main issue was that the feature never worked really well thanks to DX9 semi-awkwardness and GL's full awkwardness (never works right).
I have been looking at this and I am curious from a performance point of view. IE Is it cheaper to generate mip maps for an entire cube map every frame, or multisample the texture when reading it in the shader?

Or should I just get testing!
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5298
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1279
Contact:

Re: RTT as HlmsPbs detail map

Post by dark_sylinc »

Except the most simple cases, mipmapping should always win.
In one case you're multisampling every time, while in the other you bake the results once.

Needless to say, there's a point where the curves meet. (there are also other variables in favour of generating mipmapping: adding more code to an already complex shader increases shader pressure which limits its occupancy, you need to run a dynamic loop based on the mip level instead of running a loop whose count is known at compile time and can even be unrolled)
User avatar
miki3d
Halfling
Posts: 56
Joined: Wed Jul 18, 2012 1:30 pm
Location: Italy
x 4

Re: RTT as HlmsPbs detail map

Post by miki3d »

dark_sylinc wrote:That picture looks beautiful!

As for the problem: I'm afraid AUTOMIPMAP and RENDERTARGET aren't working together. I guess it should be fixed promptly.
The main issue was that the feature never worked really well thanks to DX9 semi-awkwardness and GL's full awkwardness (never works right).
Tnx :)

Just to ask, is there any plan about this fix?

We're also watching for screen-space-local-reflections, it's really cool. What do you think about it?
Image
Co-Founder and Design Director at VaeVictis
Current project Racecraft
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: RTT as HlmsPbs detail map

Post by xrgo »

miki3d wrote:We're also watching for screen-space-local-reflections, it's really cool. What do you think about it?
some time ago I tried to have screen space reflections on ogre 1.9, I had something almost working with this code: https://www.opengl.org/discussion_board ... eflections
but I never make it work as expected =(
Since its a post process effect you going to need some sort of Gbuffer so you can have the color, specular and roughness values as inputs, and I think you going to have the same mipmaping problem
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5298
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1279
Contact:

Re: RTT as HlmsPbs detail map

Post by dark_sylinc »

miki3d wrote:Just to ask, is there any plan about this fix?
Next thing on my mind. Just been extremely busy. Still am.

There are two possible solutions I will try:
  • Automatic. When you render to an RTT the mipmaps get tagged as dirty. Next time it's used as a texture they get autogen-ed again. Not sure if this is going to be easy due to how old the texture code is.
  • Manual. If Automatic is too problematic, user must issue a compositor pass to rebuild the mipmaps. This should be quite easy to do.
Ideally I should try the automatic method first. Unless someone here gives a compelling reason for using compositor passes instead for a manual control (and spare me the time!)
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5298
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1279
Contact:

Re: RTT as HlmsPbs detail map

Post by dark_sylinc »

Added mipmap autogen. Tested, it works (ok... only tested with 2D textures, not with cubemaps, but should work).

However the compositor textures don't get created with TU_AUTOMIPMAP yet, so it will only work for textures you create manually with that flag.

I also realized a manual pass for populating the mipmaps is manually necessary; as auto mipmap may generate a lot of unnecessary mips (e.g. write to then read from an RTT lots of times, but only generate mipmaps once you're done at the end).
xrgo
OGRE Expert User
OGRE Expert User
Posts: 1148
Joined: Sat Jul 06, 2013 10:59 pm
Location: Chile
x 168

Re: RTT as HlmsPbs detail map

Post by xrgo »

Thank you so much!!! mipmap generation its working!!! now I don't have to save my cubemaps to pngs everytime
I haven't tested performance for real time cubemaps since I don't need that yet, hopefuly miki3D can report on that
Thanks again!
Post Reply