Advanced Effects

You are an experienced programmer and have a problem with the engine, shaders, or advanced effects? Here you'll get answers.
No questions about C++ programming or topics which are answered in the tutorials!
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

To get the "Final Normals" (by Tan Normal map) from a GEOMETRY RENDER into a G - Buffer for use by the Deferred Renderer the Vertex Program is:

Code: Select all

 
 
 //  - VERTEX PROGRAM -  by Jacques Andre Pretorius 2017..
 
 uniform mat4 M01World;    // Calculated in the Appcode..
 
 varying vec3 Tangent;    // see "gl_MultiTexCoord1.xyz"..
 varying vec3 Binormal;   // see "gl_MultiTexCoord2.xyz"..
 varying vec2 UVCoordsXY;
 varying vec3 VNormal;
 
 void main()
  {UVCoordsXY         = gl_MultiTexCoord0.xy;
   VNormal           = normalize(vec3(M01World * vec4(gl_Normal.xyz, 0 )).xyz);
   Tangent           = normalize(vec3(M01World * vec4(gl_MultiTexCoord1.xyz, 0 )).xyz);
   Binormal          = normalize(vec3(M01World * vec4(gl_MultiTexCoord2.xyz,0)).xyz);
   gl_Position       = gl_ModelViewProjectionMatrix * gl_Vertex;
  }
 
 
 
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

The accompanying GEOMETRY RENDER "Fragment Program" for this task is:

Code: Select all

 
 
 // Generates the FINAL NORMALS given the Tangent NORMAL MAP..
 // For use in Deferred Rendering..
 
 uniform sampler2D Image002;
 
 varying vec2 UVCoordsXY; 
 varying vec3 VNormal;
 varying vec3 Tangent;
 varying vec3 Binormal;
                                          
 void main()
  {
   vec4 MappedNormals  = texture2D(Image002,UVCoordsXY);
   vec3 UnCompressedNormal;
   float NormalAmp = 2.0;
   UnCompressedNormal.x = (MappedNormals.x - 0.5) * NormalAmp;
   UnCompressedNormal.y = (MappedNormals.y - 0.5) * NormalAmp;
   UnCompressedNormal.z = (MappedNormals.z - 0.5) * NormalAmp;
   vec3 FinalNormal;
   // DO NOT TRY TO CALCULATE THE BINORMALS IN THE SHADER..
   FinalNormal = normalize((UnCompressedNormal.x * Tangent)
                          +(UnCompressedNormal.y * Binormal)
                          +(UnCompressedNormal.z * VNormal) 
                          );
   vec3 RangeCompressedFinalNormal = 0.5 * FinalNormal.xyz + 0.5;
   gl_FragColor.xyz = RangeCompressedFinalNormal; 
   gl_FragColor.w = 1.0; 
  }
  
 
 
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

The DEFERRED RENDERER reads different buffers rendered to the screen quad as follows..
(the usual screen quad Vertex Program)

The Deferred Renderer "Fragment Shader":
(This outputs LIT RAW DIFFUSE or/and SPECULAR mixed in by inter buffer render elsewhere)

Code: Select all

 
 // DEFERRED RENDERER..
 
 // Written by Jacques Pretorius 2017.. "VECTROTEK"..
 
 #version 120
 
 uniform sampler2D Image01;    // 24 Bit DEPTH (see "Packing / Encoding" versus "Un-Packing / Decoding")..
 uniform sampler2D Image02;    // Range Compressed NORMALS (to be Un-Range Compressed in here)..
 // No Matrix-Transforms needed! 
 uniform vec3  CameraPosition;
 uniform vec3  NearLeftUpXYZ;   // Clockwise starting at Far Left Up..
 // uniform vec3  NearRightUpXYZ; // Not used..
 uniform vec3  NearLeftDwnXYZ;
 uniform vec3  NearRightDwnXYZ;
 uniform vec3  FarLeftUpXYZ;   // Clockwise starting at Far Left Up..
 // uniform vec3  FarRightUpXYZ; // Not used..
 uniform vec3  FarLeftDwnXYZ;
 uniform vec3  FarRightDwnXYZ;
 // - - - - - - - - - - - - - - - - - - - - - - -
 struct Light   {vec3 Pos; vec3 Col;}; // Structure to hold our lights..
 const int LIGHT_COUNT = 6;            // See how "const" or "#define" must be used to size the array.. 
                                       //(alas, App-fed value can't be used) (may-be later GLSL's)..
 Light LightsArray [LIGHT_COUNT];
 
 float UnPackDepth_002(vec3 RGBDepth) {return RGBDepth.x + (RGBDepth.y / 255.0) + (RGBDepth.z / 65535.0);}
 
 void main()
  {
   vec2 UVCoordsXY       = gl_TexCoord[0].xy;
   vec3 Depth24BitPacked = texture2D(Image01, UVCoordsXY).xyz;
   vec4 Depth32BitPacked = texture2D(Image01, UVCoordsXY).xyzw;
   vec3 RCNormalIN       = texture2D(Image02, UVCoordsXY).xyz;
   vec3 RCNormalINWINDOW = texture2D(Image02,  (UVCoordsXY.xy * vec2(4.0,4.0))).xyz;
   vec3 Depth24BitPackedWINDOW  = texture2D(Image01, (UVCoordsXY.xy * vec2(4.0,4.0)) - vec2(1.0, 0.0)).xyz;
   vec3 Depth24BitPackedWINDOWB = texture2D(Image01, (UVCoordsXY.xy * vec2(4.0,4.0)) - vec2(2.0, 0.0)).xyz;
   vec3 URCNormal = normalize((RCNormalIN.xyz - 0.5) * 2);
   float DepthLinearised = UnPackDepth_002(Depth24BitPacked) ;
   // When a name is Postfixed by "WINDOW" then it only means that it has to be read with "Special Fixed" UV Coords..
   float DepthLinearisedWINDOW = UnPackDepth_002(Depth24BitPackedWINDOWB) ;
 
 
   // Vectrotek brings you..
   // * * * * * * * * * * * * * * * * * * * * * * * 
   vec3 FragmentPosXYZ;
   FragmentPosXYZ.x = (CameraPosition.x + ((((FarLeftDwnXYZ.x + ((FarLeftUpXYZ.x - FarLeftDwnXYZ.x) * UVCoordsXY.y)
                      + (FarRightDwnXYZ.x - FarLeftDwnXYZ.x) * UVCoordsXY.x))
                      - // Minus the Near Plane Corners..
                      ((NearLeftDwnXYZ.x + ((NearLeftUpXYZ.x - NearLeftDwnXYZ.x) * UVCoordsXY.y)
                      + (NearRightDwnXYZ.x - NearLeftDwnXYZ.x) * UVCoordsXY.x))) * DepthLinearised))
                      // Plus (Near Minus Camera)..
                      + ((((NearLeftDwnXYZ.x + ((NearLeftUpXYZ.x - NearLeftDwnXYZ.x) * UVCoordsXY.y)
                      + (NearRightDwnXYZ.x - NearLeftDwnXYZ.x) * UVCoordsXY.x))) - CameraPosition.x );
                        
   FragmentPosXYZ.y = (CameraPosition.y + (((FarLeftDwnXYZ.y + ((FarLeftUpXYZ.y - FarLeftDwnXYZ.y) * UVCoordsXY.y)
                      + (FarRightDwnXYZ.y - FarLeftDwnXYZ.y) * UVCoordsXY.x)
                      - // Minus the Near Plane Corners..
                       ((NearLeftDwnXYZ.y + ((NearLeftUpXYZ.y - NearLeftDwnXYZ.y) * UVCoordsXY.y)
                      + (NearRightDwnXYZ.y - NearLeftDwnXYZ.y) * UVCoordsXY.x))) * DepthLinearised))
                      // Plus (Near Minus Camera)..
                      + ((((NearLeftDwnXYZ.y + ((NearLeftUpXYZ.y - NearLeftDwnXYZ.y) * UVCoordsXY.y)
                      + (NearRightDwnXYZ.y - NearLeftDwnXYZ.y) * UVCoordsXY.x))) - CameraPosition.y);
                      
   FragmentPosXYZ.z = (CameraPosition.z + (((FarLeftDwnXYZ.z + ((FarLeftUpXYZ.z - FarLeftDwnXYZ.z) * UVCoordsXY.y)
                      + (FarRightDwnXYZ.z - FarLeftDwnXYZ.z) * UVCoordsXY.x)                  
                      - // Minus the Near Plane Corners..
                      ((NearLeftDwnXYZ.z + ((NearLeftUpXYZ.z - NearLeftDwnXYZ.z) * UVCoordsXY.y)
                      + (NearRightDwnXYZ.z - NearLeftDwnXYZ.z) * UVCoordsXY.x))) * DepthLinearised))
                      // Plus (Near Minus Camera)..
                      + ((((NearLeftDwnXYZ.z + ((NearLeftUpXYZ.z - NearLeftDwnXYZ.z) * UVCoordsXY.y)
                      + (NearRightDwnXYZ.z - NearLeftDwnXYZ.z) * UVCoordsXY.x))) - CameraPosition.z );      
 
   float Scaler = 100.0;
   // A Few Lights of which the first one is at CAMERA POSITION..
   // /*
   LightsArray [0].Col = vec3( 1.0 , 1.0 , 0.0); // Yellow..
   LightsArray [5].Col = vec3( 1.0 , 0.5 , 0.0); // Orange..
   LightsArray [4].Col = vec3( 1.0 , 0.0 , 0.0); // Red..
   LightsArray [3].Col = vec3( 0.8 , 0.0 , 0.8); // Purple..
   LightsArray [2].Col = vec3( 0.0 , 0.4 , 1.0); // Blue..
   LightsArray [1].Col = vec3( 0.0 , 1.0 , 0.0); // Green..
   // */
   /*
   LightsArray [0].Col = vec3( 0.5 , 0.5 , 0.5);
   LightsArray [1].Col = vec3( 0.5 , 0.5 , 0.5);
   LightsArray [2].Col = vec3( 0.5 , 0.5 , 0.5);
   LightsArray [3].Col = vec3( 0.5 , 0.5 , 0.5);
   LightsArray [4].Col = vec3( 0.5 , 0.5 , 0.5);
   LightsArray [5].Col = vec3( 0.5 , 0.5 , 0.5);
   // */
   
   LightsArray [0].Pos = vec3( -0.00186  , 6.88994  , 1.6034) * Scaler; // Camera, so overridden..
   LightsArray [1].Pos = vec3( 1.94612 , 5.55791    , -0.19679) * Scaler;
   LightsArray [2].Pos = vec3( 1.97002    , 3.9126 , 1.75955) * Scaler;
   LightsArray [3].Pos = vec3( -0.00186    , 2.24885    , 2.05329) * Scaler;
   LightsArray [4].Pos = vec3( -1.876110 , 3.9126    , 1.75955) * Scaler;
   LightsArray [5].Pos = vec3( -2.00107    , 5.55791    , -0.19679) * Scaler;
   
   // Just sothat we have at least one light at Cam pos..
   LightsArray [0].Pos = CameraPosition.xyz; 
 
   vec3 Diffuse;
   vec3 Specular;
 
   //==================================================
 
   for (int LI = 0; LI < LIGHT_COUNT - 0 ; LI++)
    {// LOTS more can be done here, but this shows Basic Deferred Rendering at work..
     // DIFFUSE..
     Diffuse  += max(dot(URCNormal, normalize((LightsArray [LI].Pos.xyz) - FragmentPosXYZ)), 0.0) * LightsArray [LI].Col;
     // DO THIS HERE OR DO THIS IN ANOThER PASS FOR ANOTHER BUFFER..
     // SPECULAR..
     //Specular += LightsArray [LI].Col * (clamp(pow(clamp(dot(normalize((normalize((CameraPosition.xyz - FragmentPosXYZ))
     //         + normalize(LightsArray [LI].Pos - FragmentPosXYZ))),
     //         URCNormal)
     //         ,0.0,1.0),  512.0), 0.0 , 1.0 )); 
    }
 
   // YOU CAN DELETE THIS BUT SHOWS USEFULL LITTLE WINDOWS..
   if (UVCoordsXY.y > 0.25)
    {
     gl_FragColor = vec4(Diffuse * 0.8, 1.0);
    } 
  }
 // END..
 
Last edited by Vectrotek on Thu Feb 23, 2017 3:46 pm, edited 1 time in total.
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

The Normals must have their Tangents and Binormals updated.

My "Scenegraph" has it like this:

Code: Select all

 
     SceneMeshCount = My3DScene->GetSkinnedMeshNodeCount();
     // TanUpdStatus = false;
     TanUpdStatus = true;
     //  PLEASE OPTIMIZE THIS or simply do it as irrlicht does it internally....
     if (TanUpdStatus == true)
      {
       for (u32 SMeshI = 0; SMeshI < SceneMeshCount; SMeshI++) 
        {if (My3DScene->AccessSkinnedMeshInstanceNode(SMeshI)->getType() == EAMT_SKINNED)
          {AcquiredTARGETAnimeshByIndex = My3DScene->AccessSkinnedMeshInstanceNode(SMeshI)->getMesh(); 
           TheMBufferCount = AcquiredTARGETAnimeshByIndex->getMeshBufferCount();
           u16* TheINDEXPtrTANS;
           u32 TheIndexCount;
           for (u32 MBuffI = 0 ; MBuffI < TheMBufferCount ; MBuffI++)
            {
             CurrMeshBuffPtr = AcquiredTARGETAnimeshByIndex->getMeshBuffer(MBuffI);
             CurrTanVertsPtr  = (video::S3DVertexTangents*)CurrMeshBuffPtr->getVertices();
             TheINDEXPtrTANS =    TheSceneMeshCache->getMeshByIndex(SMeshI)->getMeshBuffer(MBuffI)->getIndices();
             TheIndexCount = (u32)TheSceneMeshCache->getMeshByIndex(SMeshI)->getMeshBuffer(MBuffI)->getIndexCount();
             for (u32 IndexII = 0; IndexII < TheIndexCount; IndexII+=3)
              {
               VertexTriA = CurrTanVertsPtr[TheINDEXPtrTANS[IndexII]];
               VertexTriB = CurrTanVertsPtr[TheINDEXPtrTANS[IndexII+1]];
               VertexTriC = CurrTanVertsPtr[TheINDEXPtrTANS[IndexII+2]];
               f32 TAX = VertexTriA.Pos.X;   f32 TAY = VertexTriA.Pos.Y; f32 TAZ = VertexTriA.Pos.Z; 
               f32 TBX = VertexTriB.Pos.X;   f32 TBY = VertexTriB.Pos.Y; f32 TBZ = VertexTriB.Pos.Z;
               f32 TCX = VertexTriC.Pos.X;   f32 TCY = VertexTriC.Pos.Y; f32 TCZ = VertexTriC.Pos.Z;
               f32 TAU = VertexTriA.TCoords.X; f32 TAV = VertexTriA.TCoords.Y;   VertexTriA.TCoords.X = 1.0;
               f32 TBU = VertexTriB.TCoords.X; f32 TBV = VertexTriB.TCoords.Y;
               f32 TCU = VertexTriC.TCoords.X; f32 TCV = VertexTriC.TCoords.Y;
               f32 DV1X = TBX - TAX ; f32 DV1Y = TBU - TAU ; f32 DV1Z = TBV - TAV;
               f32 DV2X = TCX - TAX ; f32 DV2Y = TCU - TAU ; f32 DV2Z = TCV - TAV;
               f32 DV3X = TBY - TAY ; f32 DV3Y = TBU - TAU ; f32 DV3Z = TBV - TAV;
               f32 DV4X = TCY - TAY ; f32 DV4Y = TCU - TAU ; f32 DV4Z = TCV - TAV;
               f32 DV5X = TBZ - TAZ ; f32 DV5Y = TBU - TAU ; f32 DV5Z = TBV - TAV;
               f32 DV6X = TCZ - TAZ ; f32 DV6Y = TCU - TAU ; f32 DV6Z = TCV - TAV;
               f32 CAX = (DV1Y * DV2Z) - (DV2Y * DV1Z); f32 CAY = (DV1Z * DV2X) - (DV2Z * DV1X);
               f32 CAZ = (DV1X * DV2Y) - (DV2X * DV1Y); f32 CBX = (DV3Y * DV4Z) - (DV4Y * DV3Z);
               f32 CBY = (DV3Z * DV4X) - (DV4Z * DV3X); f32 CBZ = (DV3X * DV4Y) - (DV4X * DV3Y);
               f32 CCX = (DV5Y * DV6Z) - (DV6Y * DV5Z); f32 CCY = (DV5Z * DV6X) - (DV6Z * DV5X);
               f32 CCZ = (DV5X * DV6Y) - (DV6X * DV5Y);
               f32 TanX = (CAY / CAX);  f32 TanY = (CBY / CBX);  f32 TanZ = (CCY / CCX); 
               f32 BinX = (CAZ / CAX);  f32 BinY = (CBZ / CBX);  f32 BinZ = (CCZ / CCX); 
               CurrTanVertsPtr[TheINDEXPtrTANS[IndexII]].Tangent.X = -TanX;
               CurrTanVertsPtr[TheINDEXPtrTANS[IndexII]].Tangent.Y = -TanY;
               CurrTanVertsPtr[TheINDEXPtrTANS[IndexII]].Tangent.Z = -TanZ;
               CurrTanVertsPtr[TheINDEXPtrTANS[IndexII+1]].Tangent.X = -TanX;
               CurrTanVertsPtr[TheINDEXPtrTANS[IndexII+1]].Tangent.Y = -TanY;
               CurrTanVertsPtr[TheINDEXPtrTANS[IndexII+1]].Tangent.Z = -TanZ;
               CurrTanVertsPtr[TheINDEXPtrTANS[IndexII+2]].Tangent.X = -TanX;
               CurrTanVertsPtr[TheINDEXPtrTANS[IndexII+2]].Tangent.Y = -TanY;
               CurrTanVertsPtr[TheINDEXPtrTANS[IndexII+2]].Tangent.Z = -TanZ;
               CurrTanVertsPtr[TheINDEXPtrTANS[IndexII]].Binormal.X = BinX;
               CurrTanVertsPtr[TheINDEXPtrTANS[IndexII]].Binormal.Y = BinY;
               CurrTanVertsPtr[TheINDEXPtrTANS[IndexII]].Binormal.Z = BinZ;
               CurrTanVertsPtr[TheINDEXPtrTANS[IndexII+1]].Binormal.X = BinX;
               CurrTanVertsPtr[TheINDEXPtrTANS[IndexII+1]].Binormal.Y = BinY;
               CurrTanVertsPtr[TheINDEXPtrTANS[IndexII+1]].Binormal.Z = BinZ;
               CurrTanVertsPtr[TheINDEXPtrTANS[IndexII+2]].Binormal.X = BinX;
               CurrTanVertsPtr[TheINDEXPtrTANS[IndexII+2]].Binormal.Y = BinY;
               CurrTanVertsPtr[TheINDEXPtrTANS[IndexII+2]].Binormal.Z = BinZ;
              }  // end Index Loop..     
            }  // end Buffer Loop 
          } // End Only "Skinned" meshes..
        } // end loop "SMESHI"     
      }  // End user determined conditional Tangents & Binormal Update..
     // END of Tangent and Binormals Updating..
     // Note that you may encounter strange black areas on  your models..
     // This is not a bug, it is the result of poor UV UNWRAPPING..
     // The solution would be to Re-Unwrap your UV Map and to make sure that UV positions for a given triangle
     // also looks like a triangle on the UV  Map..
     // This is a common problem in even the latest game ripped models..
 
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Here is an attempt at a little scene graph built on top of Irrlicht Scenegraph..

Code: Select all

 
 
 #ifndef MAIN_SCENEGRAPH_INC_INCD
 #define MAIN_SCENEGRAPH_INC_INCD
 
 #include "H_000_main_include.h"
 //--------------------------------- ---- --- -- - 
 using namespace irr;
 using namespace core;
 using namespace scene;
 using namespace video;
 using namespace gui;
 //--------------------------------- ---- --- -- - 
 // THIS HAS BEEN LONG OVERDUE AND NOW THAT THINGS ARE GETTING INTERESTING THE NEED FOR SUCH A SCENE MANAGEMENT
 // SYSTEM BECOMES CLEAR..
 // The aim of this module is to offer the coder a flexible, sensible way to treat
 // a scene and the 3D Geometric Objects in it..
 // We're talking Cameras, Particles, Static Models, Animated Models, Skinned Models, Octrees, Materials, Motion Paths, etc etc..
 // (now only the three main geometry types)
 
 // Irrlicht offers a good "scenegraph" system by which the coder carefully selects which type of object he is
 // dealing with making the coding a bit less generic as one would wish..
 
 // This set of classes would be one solution to managing a scene and its content as an integrated and manageable unit..
 
 // An example of what is meant by "Generic Items" would be, say a "skinned mesh" for a character and a "animated mesh" for a projectile
 // and a "Static Mesh" for a level that never moves around that can all be treated in the same way in terms of Commands, Material Access etc..
 
 // Now all these different "types" of objects have different ways of manageing them.
 // One has to carefully differentiate between a skinned mesh and an animated mesh when dealing with, say, its materials.
 
 // I think that we could use a class that would encapsulate all these different types of items found in Irrlicht
 // which would "automatically" and "smartly" decide what to do with them when given a command by the coder..
 
 // Once such a Generic Item class had been developed then these items could exist as an Array in a scene which would then be
 // easier to handle..
 
 // Could we have this "publically related" to anything Irrlicht has to offer?
 
 
 // Model types..
 // (a link between what the coder understands about 3d objects and how Irrlicht sees them internally)
 #define SKINNEDMODEL          0 // Like Chatacters..
 #define STATICMODEL           1 // Like Simple moveable objects..
 #define OCTREE                2 // A Level..
 
 //                                                                                        
 class VectrotekScene
  {public:
   VectrotekScene (scene::ISceneManager* TheManager);
   ~VectrotekScene ();
   AddAnimatedMesh (const char* FileName);
   IAnimatedMesh* AccessAnimatedMesh  (u32 Index);  
   u32 GetAnimatedMeshCount ();
   u32 GetSkinnedMeshNodeCount  ();
   u32 GetStaticMeshNodeCount ();
   u32 GetOctreeMeshNodeCount ();
   AddSkinnedMeshInstanceNode (u32 IndexAnimatedMesh);
   IAnimatedMeshSceneNode* AccessSkinnedMeshInstanceNode (u32 Index);
   AddStaticMeshInstanceNode (u32 IndexAnimatedMesh);
   ISceneNode* AccessStaticMeshInstanceNode (u32 Index);
   AddOctreeMeshInstanceNode (u32 IndexAnimatedMesh , u32 MinNodePolys);
   ISceneNode* AccessOctreeMeshInstanceNode (u32 Index);
   IAnimatedMesh* AccessAnimatedMeshInstanceNode    (u32 Index);
 
   private:
   scene::ISceneManager* PassedSceneManager; // Which we need in here..
   u32 AnimatedMeshCount;
   u32 SkinnedNodeCount;
   u32 StaticMeshNodeCount;
   u32 OctreeMeshNodeCount;
   // The 3D Geometry Objects as they were loaded..
   core::array <IAnimatedMesh*> AnimatedMeshes;
   // The created INSTANCES of SKINNED Models.. ("Animated Characters" and other skinned objects)
   core::array <IAnimatedMeshSceneNode*> AnimatedSKINNEDMeshPointers;
   // The created INSTANCES of STATIC Models..
   // These are "Non-Skinned Objects" (yet animatable in terms of position scale and rotation)
   // like "Level Props"..
   core::array <ISceneNode*> AnimatedSTATICISceneNodePointers;
   // "Octree Models" like "Complete Levels" which are rarely Moved, Scaled or Rotated..
   core::array <ISceneNode*> AnimatedOCTREEISceneNodePointers;
  };
 
 //                                                                                        
 
 VectrotekScene::VectrotekScene (scene::ISceneManager* TheManager)
  {PassedSceneManager  = TheManager;
   AnimatedMeshCount   = 0;
   SkinnedNodeCount    = 0;
   StaticMeshNodeCount = 0;
   OctreeMeshNodeCount = 0;
  }
 
 VectrotekScene::~VectrotekScene ()
  {}
 
 VectrotekScene::AddAnimatedMesh (const char* FileName)
  {IAnimatedMesh* NewAnimatedMesh;
   NewAnimatedMesh =  PassedSceneManager->getMesh(stringc(FileName));
   AnimatedMeshes.push_back(NewAnimatedMesh); // The pointer becomes "unique" and stored safely!!
   AnimatedMeshCount++;
  }
 
 u32 VectrotekScene::GetAnimatedMeshCount ()
  {return AnimatedMeshCount;
  }
 
 u32 VectrotekScene::GetSkinnedMeshNodeCount ()
  {return SkinnedNodeCount;
  }
 
 u32 VectrotekScene::GetStaticMeshNodeCount ()
  {return StaticMeshNodeCount;
  }
 u32 VectrotekScene::GetOctreeMeshNodeCount ()
  {return OctreeMeshNodeCount;
  }
 
 VectrotekScene::AddSkinnedMeshInstanceNode (u32 IndexAnimatedMesh)
  {
   ((ISkinnedMesh*)AnimatedMeshes[IndexAnimatedMesh])->convertMeshToTangents();
   AnimatedSKINNEDMeshPointers.push_back(PassedSceneManager->addAnimatedMeshSceneNode((ISkinnedMesh*)AnimatedMeshes[IndexAnimatedMesh]));
   SkinnedNodeCount++;
  }
 
 IAnimatedMeshSceneNode* VectrotekScene::AccessSkinnedMeshInstanceNode (u32 Index)
  {return AnimatedSKINNEDMeshPointers[Index];
  }
 VectrotekScene:: AddStaticMeshInstanceNode (u32 IndexAnimatedMesh)
  {
   IAnimatedMesh* AnimatedMeshjj = (IAnimatedMesh*)PassedSceneManager->getMeshManipulator() 
     -> createMeshWithTangents(AnimatedMeshes[IndexAnimatedMesh], false, false, false, true );
   AnimatedSTATICISceneNodePointers.push_back(PassedSceneManager->addMeshSceneNode(AnimatedMeshjj)  );
   StaticMeshNodeCount++;   
  }
 
 ISceneNode*  VectrotekScene::AccessStaticMeshInstanceNode (u32 Index)
  {return AnimatedSTATICISceneNodePointers[Index];
  }
 
 VectrotekScene:: AddOctreeMeshInstanceNode (u32 IndexAnimatedMesh , u32 MinNodePolys)
  {    
   scene::ISceneNode*              ISceneNode_OCTREE_TARGET;
   scene::IMesh*                   IMesh_TARGET_With_Tangents;
   IMesh_TARGET_With_Tangents = PassedSceneManager->getMeshManipulator() ->
                             createMeshWithTangents(AnimatedMeshes[IndexAnimatedMesh], false, false, false, true );
   ISceneNode_OCTREE_TARGET = PassedSceneManager->addOctreeSceneNode(IMesh_TARGET_With_Tangents, 0, -1, 32 * 1);
   IMesh_TARGET_With_Tangents->drop();  // WHY DID THIS SUDDENLY WORK?
   AnimatedOCTREEISceneNodePointers.push_back(ISceneNode_OCTREE_TARGET);
   OctreeMeshNodeCount++;   
  }    
 
 ISceneNode*  VectrotekScene::AccessOctreeMeshInstanceNode (u32 Index)
  {return AnimatedOCTREEISceneNodePointers[Index];
  }
 
 // This function would access the 3d objects in animated mesh form in the order they were loaded..
 // I don't have a use for this one yet..
 
 IAnimatedMesh* VectrotekScene::AccessAnimatedMesh (u32 Index)
  {return AnimatedMeshes[Index];
  }
 
 //                                                                                        
 
 
 #endif
 
 // END  H_019_MAIN_SCENEGRAPH.h
 
 
 
 
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Its easy to "Over blur" a SSAO buffer..
Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Six white lights..

Image
Last edited by Vectrotek on Fri Feb 24, 2017 4:15 pm, edited 1 time in total.
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Six Coloured Lights..

Image
devsh
Competition winner
Posts: 2057
Joined: Tue Dec 09, 2008 6:00 pm
Location: UK
Contact:

Re: Advanced Effects

Post by devsh »

Vectrotek... could you donate an few stills of an uncompressed GBuffer to me?
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Sure, but exactly what do you mean by uncompressed? Mine are still separate images in buffers which are fed into a final Deferred Renderer.
I've got Depth, and Normals from which the Fragment Positions are calculated. These sort Diffuse and Specular..
Also I render SSAO, Specular and Gloss which are overlaid outside of the deferred renderer on to a final buffer.
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Here is a few final shots with a new version of the deferred shader that also calculates Gloss..
Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Image
Vectrotek
Competition winner
Posts: 1087
Joined: Sat May 02, 2015 5:05 pm

Re: Advanced Effects

Post by Vectrotek »

Image
Post Reply