Render camera to texture no longer working?

For topics related to the creation of simulation objects (SimObjects). This includes development of aircraft, ground, and maritime vehicles.
Post Reply
quid21
Posts: 98
Joined: Wed Dec 11, 2013 7:03 pm
Location: Newmarket, UK
Contact:

Render camera to texture no longer working?

Post by quid21 »

In P3D V5.4 backwards, I could render a camera to texture eg. for mirrors.

In P3D V6.1, this no longer works. The render to texture for my P3D default ground radar works, but the render to texture for my cameras do not.

As far as I can see, this feature hasn't changed in the SDK, so I believe it to be a bug.

In the cfg I have:

[CameraDefinition.5]
Title = "narrow"
Guid = {20751A39-E38A-4BE7-B35A-7BD79B85D356}
Origin = Virtual Cockpit
Category = Outside
MomentumEffect = FALSE
SnapPbhAdjust = None
SnapPbhReturn = FALSE
PanPbhAdjust = None
PanPbhReturn = FALSE
Track = None
ShowAxis = No
AllowZoom = false
InitialZoom=0.0
SmoothZoomTime = 0.0
ZoomPanScalar = 0.0
ShowWeather = Yes
XyzAdjust = FALSE
ShowLensFlare = TRUE
PitchPanRate = 0
HeadingPanRate = 0
PanAcceleratorTime = 0
ClipMode = Normal
HideShadows = 1
HideReflection = 1
HideModels = 1
HideParticles = 1
HideUserAircraft = 1
HideAutogen = 1
HideScreenSpace = 1
HideMissionObjects = 0
ShowLabels = FALSE
HideSky = 0
HideTerrain = 0
RenderToTexture = TRUE
RenderToScreen = FALSE
UseGlobalTerrainView = true
OffsetP = 0
OffsetB = 0
OffsetH = 0
InitialXyz = 0, 10, 0
InitialPbh = 90, 0, 0
AllowBelowGround = false
TextureSizeX = 1024
TextureSizeY = 1024
VerticalFOV = 56
HorizontalFOV = 56

In the gauge I have:

<Gauge Name="narrow" Version="1.0">
<Image Name="background.bmp" />
<Element>
<Position X="0" Y="0" />
<Texture Name="narrow" Width="100" Height="100" />
</Element>
</Gauge>
User avatar
Rob McCarthy
Lockheed Martin
Posts: 3704
Joined: Wed Aug 24, 2011 1:37 pm

Re: Render camera to texture no longer working?

Post by Rob McCarthy »

Hello,

Thanks for the report. Are you able to see the RTT view if the panel is undocked? Also in the camera configuration file the minimum supported zoom value is 0.3.

Regards,
Rob McCarthy
Rob McCarthy
Prepar3D® Core Lead
quid21
Posts: 98
Joined: Wed Dec 11, 2013 7:03 pm
Location: Newmarket, UK
Contact:

Re: Render camera to texture no longer working?

Post by quid21 »

Hi Rob,

This camera is set up so that it is applied to a texture map in the virtual cockpit, I don't use a camera configuration file - only the cfg posted in above that is in the aircraft.cfg the title, in this case 'narrow' is directly referenced in the gauge xml.

I will try changing the zoom value, however, to achieve a downwards looking viewsight, I used the field of view values directly from the pilots manual. I have a separate part called 'wide' for the larger field of view. I'll report back if adjusting the zoom to 0.3 changes anything.

It used to work in previous versions of P3D until V6.1.

Thanks for looking into it.

EDIT: Adjusted the Initial zoom value to 0.4, but no difference. Its odd because the RTT for radar still works, just not the camera....

David.
User avatar
Beau Hollis
Lockheed Martin
Posts: 2452
Joined: Wed Oct 06, 2010 3:25 pm

Re: Render camera to texture no longer working?

Post by Beau Hollis »

It looks like the alpha channel of the RTT view is 0 for some reason. We'll try to track down why and fix it but you could work around this by using TEXTURES_USE_ADDITIVE_BLEND=1 in your panel and making sure you have a black/dark background under the texture.

Code: Select all

background_color        = 1, 1, 1
TEXTURES_USE_ADDITIVE_BLEND = 1
When docked the texture draw uses an alpha blending material mode to allow it to blend with the windows behind it.
Beau Hollis
Prepar3D Software Architect
quid21
Posts: 98
Joined: Wed Dec 11, 2013 7:03 pm
Location: Newmarket, UK
Contact:

Re: Render camera to texture no longer working?

Post by quid21 »

Hi Beau,

Thanks for your kind reply.

I tried your suggestion and it produces some results, although in the case of things like mirrors and in my case downward looking optical viewsight, I can't really put a dark background since the view is an outside view facing down, so no blending required - but happy to await a fix.

David.
User avatar
Beau Hollis
Lockheed Martin
Posts: 2452
Joined: Wed Oct 06, 2010 3:25 pm

Re: Render camera to texture no longer working?

Post by Beau Hollis »

We found the underlying issue. This will be fixed in the next patch. Enabling sharpening for FSR2 is a workaround you could try in the meantime. The post process shaders for those write 1 into the alpha.

If you're texturing your windows with a vcockpit $ texture rather than the RTT texture directly, you could set an darjk background in the panel as i described. You could also add disable_alpha_write=1 to your panel if you want to make sure the final $texture ends up with 1 for the alpha.

If you are texturing directly into the model, you could also change your material blend state to make the mirror opaque which will ignore the diffuse/albedo alpha.
Beau Hollis
Prepar3D Software Architect
quid21
Posts: 98
Joined: Wed Dec 11, 2013 7:03 pm
Location: Newmarket, UK
Contact:

Re: Render camera to texture no longer working?

Post by quid21 »

Will take a look at those options.

Many thanks Beau.
Post Reply