irei1as Posted December 4, 2016 Share Posted December 4, 2016 (edited) 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):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.hlslstruct VertToPix { float4 hpos : POSITION; float2 uv : TEXCOORD0; }; VertToPix main( VertToPix In ) { return In; } xintexP.hlslstruct 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: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.)http://i.imgur.com/MIcw5FH.pngIt will be alright otherwise (another weapon equipped, like the Lurker Rifle):http://i.imgur.com/x3YGHKD.pngI 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. Edited December 7, 2016 by irei1as Quote Link to comment Share on other sites More sharing options...
Azaezel Posted December 5, 2016 Share Posted December 5, 2016 no clue why the ryder specifically, but: https://github.com/GarageGames/Torque3D/blob/development/Templates/Full/game/core/scripts/client/lighting/advanced/deferredShading.cs#L58-L68 might be pointing at order-of-operations for the blitting. Quote Link to comment Share on other sites More sharing options...
Duion Posted December 5, 2016 Share Posted December 5, 2016 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. Quote Link to comment Share on other sites More sharing options...
irei1as Posted December 7, 2016 Author Share Posted December 7, 2016 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: 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: 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.