### [Solved]: weird PostFX and Ryder incompability

Materials, textures, lighting, postfx

#### [Solved]: weird PostFX and Ryder incompability

irei1as
Posts: 76
Joined: Fri Feb 27, 2015 5:13 pm
I'm having an issue with a particular kind of PostEffect, first person view and some particular equipments of weapons.
I have absolutely no idea why this is happening so I would want to ask for a confirmation that this is common or if it's just happening with my old computer.
Note: Using DirectX.

First create a .cs with this (and then exec it somewhere, of course):

Code: Select all

function createRend() { if(!isObject(RendViewUpdater)) { %tickObj = new ScriptTickObject(RendViewUpdater); %tickObj.setProcessTicks(true); %tickObj.tNT = "PreBin1"; PreBin1.enable(); MissionCleanup.add(%tickObj); %playGuiRendWindow = new GuiBitmapCtrl() { position = "100 100"; extent = "150 150"; }; PlayGui.add(%playGuiRendWindow); %tickObj.miniWindow = %playGuiRendWindow; } } function RendViewUpdater::onInterpolateTick(%this, %delta) { (%this.miniWindow).setNamedTexture(%this.tNT); } function RendViewUpdater::onRemove(%this) { (%this.miniWindow).delete(); } singleton ShaderData( TestCopy_Shader ) { DXVertexShaderFile = "./xintexV.hlsl"; DXPixelShaderFile = "./xintexP.hlsl"; samplerNames[0] = "$inputTex"; pixVersion = 2.0; }; singleton GFXStateBlockData( TestCopy_stateblock ) { zDefined = true; zEnable = false; zWriteEnable = false; samplersDefined = true; samplerStates[0] = SamplerClampPoint; }; singleton PostEffect( PreBin1 ) { isEnabled = false; renderTime = "PFXAfterBin"; renderBin = "SkyBin"; shader = TestCopy_Shader; stateBlock = TestCopy_stateblock; texture[0] = "$backbuffer"; target = "#PreBin1"; }; 
In the same folder as the .cs add these two files:
xintexV.hlsl

Code: Select all

struct VertToPix { float4 hpos : POSITION; float2 uv : TEXCOORD0; }; VertToPix main( VertToPix In ) { return In; } 
xintexP.hlsl

Code: Select all

struct ConnectData { float2 texCoord : TEXCOORD0; }; uniform sampler2D inputTex : register(S0); //-------------------------------------------------------------- //Main //-------------------------------------------------------------- float4 main( ConnectData IN ) :COLOR { float4 color1 = tex2D(inputTex, IN.texCoord); return color1; } 

Run the desert level of a full project and in the console type:

Code: Select all

createRend()
Then the scene isn't correctly rendered in first person (render first person must be disabled in the Player datablock for the error to show) and with a particular weaponImage equipment.

It will render incorrectly if:
-You have the Ryder Pistol equipped.
-You have no image equipped ( in the console: LocalClientConnection.player.unmountImage(0); )
-You have the vehicle turret equpped ( in the console: LocalClientConnection.player.mountImage(TurretImage,0); Note: funny in third person.)

It will be alright otherwise (another weapon equipped, like the Lurker Rifle):

I really need to know if it's just my version of Torque 3d (not up to date) or if the issue it's still around.
And, um, do you know why it may be happening? Why it happens for some weapons but not for others?
Thanks a lot for your help.
Last edited by irei1as on Wed Dec 07, 2016 5:57 pm, edited 1 time in total.

#### Re: Problem: weird PostFX and Ryder incompability

Azaezel
Posts: 409
Joined: Tue Feb 03, 2015 9:50 pm

no clue why the ryder specifically, but: https://github.com/GarageGames/Torque3D ... cs#L58-L68 might be pointing at order-of-operations for the blitting.

#### Re: Problem: weird PostFX and Ryder incompability

Duion
Posts: 1053
Joined: Sun Feb 08, 2015 1:51 am

Might be that the Ryder has no muzzle point set, since this is what it would have in common with no image equipped.
In my game I noticed that the Ryder muzzle point is wrong.
No idea if this helps, those are just things I noticed, may be related or not.

#### Re: [Solved]: weird PostFX and Ryder incompability

irei1as
Posts: 76
Joined: Fri Feb 27, 2015 5:13 pm
Thanks a lot for both your insight. I was able to locate the issue from the hints.
It's related to the backbuffer not being cleared (or something like that) and GammaPostFX being picky with it.

Let me share the kind of hack for the fix.
In postEffect.cpp locate:

Code: Select all

 if ( mTargetTex || mTargetDepthStencil ) { mTarget->resolve(); GFX->popActiveRenderTarget(); } else { // We wrote to the active back buffer, so release // the current texture copy held by the manager. // // This ensures a new copy is made. PFXMGR->releaseBackBufferTex(); } 
And make it:

Code: Select all

 if ( mTargetTex || mTargetDepthStencil ) { mTarget->resolve(); GFX->popActiveRenderTarget(); PFXMGR->releaseBackBufferTex(); } else { // We wrote to the active back buffer, so release // the current texture copy held by the manager. // // This ensures a new copy is made. PFXMGR->releaseBackBufferTex(); } 
But I don't think this change is very efficient. But, well, it works for what I want to test.

#### Who is online

Users browsing this forum: No registered users and 2 guests