Jump to content

  • Log In with Google      Sign In   
  • Create Account

SIC Games

Member Since 22 Jun 2012
Offline Last Active Aug 26 2015 01:38 PM

Topics I've Started

I love assimp but the animation part is a pain - anyone got it working with DirectX?

19 August 2015 - 12:31 PM

as I said I love assimp - it's a great utility but the animation is a pain. So far my animation is stretched out but plays fine in assimp viewer. I looked at assimp viewer and it's hard to follow because I can't find any header files containing some of the functions. Like one function uses a vector and a boost:tuple for storing the position keys, rotation keys, and scaling keys of the animation. Also the code animation part runs on CPU - the ATSPACE.CO.UK runs on GPU and that's where my code came from.


I narrowed it down it's due to the global transformation. the offset transform is fine, the parentnode matrix is fine the nodetransform is fine but the globaltransform martrix going into finaltransformation to be sent to gpu is messing things up.


I quickly grabbed ieDoc's MD5 Animation loader and the dancing pill works - just a pill shape mesh dancing back and forth then side to side. I don't like MD5 mesh model because I tried to make a simple vehicle and it only imported just the front chassis of the vehicle not the wheels unlike unreal engine or unity could do.


Ah the frustrations!

unable to manually set world,view,proj in shader

17 August 2015 - 02:11 PM

Why wouldn't i be able to set the worldviewproj matrix in the shader? When I do it turns out to be covering the whole screen. When I configure it inside the render loop of mesh - it looks fine.


I need to be able to translate the meshes bones being sent to the shader - I can't do that unless I am able to:

float4x4 bwvp = mWorld * mView * mProj * bonematrix;

output.position = mul(input.position, bwvp);

the bones matrixes have their own constant buffer in array of 100. a common cb per object was created holding the World, View, Proj. I've tried:

input.position.w = 1.0f;
output.position = mul(input.position, mWorld);
output.position = mul(output.position, mView);
output.position = mul(output.position, mProj);

That doesn't do anything just renders the mesh covering the whole screen. Where it should look more like this:

Attached File  ScreenCaptured_nossao26616756.jpg   10.11KB   1 downloads


not like this:


Attached File  ScreenCaptured_nossao52295916.jpg   9.38KB   1 downloads


the mWorld has scale * rotation * translation from the model's world space.

Any insight what may be happening? the first image posted was from the commonperobj cbuffer's mWorldViewProj matrix.


The commonperobj cbuffer is layout is:

cbuffer cbCommonPerObj : register(b0) {
	float4x4 mWorldViewProj;
	float4x4 mWorld;
	float4x4 mView;
	float4x4 mProj;

Anyone possibly knows why?

Quick quesiton on constant buffers

15 August 2015 - 09:21 PM

Each mesh asset either static or skeletal has different constants, texture samplers, depth stencil states and vertex shaders, pixel shaders and the whole 9 yard.


I created a interface for Mesh which allows opening to StaticMesh, SkeletalMesh, Billboard, EditorPlacementMarker, MeshLight etc..


Maybe I'm over thinking this and I have a cat jumping on my desk annoying the hell out of me.


A billboard is different from static, skeletal mesh and a screen quad - I wouldn't use the same constant buffers over and over again in the shaders. Perhaps the mesh interface will alleviate   most of my issues.


The most common constant buffer like WorldViewProj, View, Proj can stay - for each model uses them.


In general there wouldn't be a huge constant buffer because that would be a waste of space - so I would imagine there would be at least somewhere each constant gets initialized for the particular shader for that particular mesh to be drawn on screen. Right?

Fix That Funny Imported FBX using ASSIMP

12 August 2015 - 02:29 PM

If you ever have imported FBX file with assimp - you'll notice that the model itself isn't imported correctly. If it turns out to be a spagetti mesh then the data wasn't loaded correctly. If the model's rotation was facing towards -Y axis where in 3DS Max or whatever 3D modeling tool you used is facing towards the +Z Up Axis or +Z Axis depending on modeling program again.


I created a very simple white wall with wood floor trim - i deleted the remaining unnecessary polygons. Upon importing the model to ASSIMP Scene you'll notice aiProcess_ declarations. The aiProcess declarations I used is as:

unsigned int processFlags =
		aiProcess_CalcTangentSpace | // calculate tangents and bitangents if possible
		aiProcess_JoinIdenticalVertices | // join identical vertices/ optimize indexing
		//aiProcess_ValidateDataStructure  | // perform a full validation of the loader's output
		aiProcess_Triangulate | // Ensure all verticies are triangulated (each 3 vertices are triangle)
		aiProcess_ConvertToLeftHanded | // convert everything to D3D left handed space (by default right-handed, for OpenGL)
		aiProcess_SortByPType | // ?
		aiProcess_ImproveCacheLocality | // improve the cache locality of the output vertices
		aiProcess_RemoveRedundantMaterials | // remove redundant materials
		aiProcess_FindDegenerates | // remove degenerated polygons from the import
		aiProcess_FindInvalidData | // detect invalid model data, such as invalid normal vectors
		aiProcess_GenUVCoords | // convert spherical, cylindrical, box and planar mapping to proper UVs
		aiProcess_TransformUVCoords | // preprocess UV transformations (scaling, translation ...)
		aiProcess_FindInstances | // search for instanced meshes and remove them by references to one master
		aiProcess_LimitBoneWeights | // limit bone weights to 4 per vertex
		aiProcess_OptimizeMeshes | // join small meshes, if possible;
		aiProcess_PreTransformVertices | //-- fixes the transformation issue.
		aiProcess_SplitByBoneCount | // split meshes with too many bones. Necessary for our (limited) hardware skinning shader

You'll notice the aiProcess_PreTransformVerticies that right there did the fix for me. Inside your modeller program if you're using Units of Feet - just know that the model will be imported large because it's using the 3D Modelling's units set up. I set my to export at 1 unit = 1 inch and unit's conversion to be inch 1.0 scale.


Here's a pretty snap shot taking from the app.

Attached File  ScreenCaptured_nossao12079246.jpg   66.97KB   1 downloads


Pretty nice wall eh? I can't model a female character worth a damn though but maybe I'll get there sooner or later. My female characters turn out to be creatures and somehow very not attractive - their faces look sinister and evil - don't know why that is. Any who - continuing on...


If you do get spaghetti meshes - it's mostly because of the indices. Conversion from openGL to DirectX isn't my best - so most of ASSIMP tutorials are in openGL including the skeletal animation which I still yet have to convert to DX understanding. 


I didn't really know where to post this half tutorial - so I posted it in coding horrors because sometimes coding can give nightmares. Oh forget the whole file format of the snap shot Screen-nossao - the file is generated with the resulting salt and a random seed of the time date kind of thing. SSAO is disabled for now until I get it working.


At first I cringed at using ASSIMP but it's beneficial in many ways - regardless how bulky the dll file is. If you're ASSImp (which is a funny name - I keep on thinking of the Doom's Imps.) - and run into either spaghetti meshes or the model is transforming on the not right axis - then would be a good read.



Kicked from chat - wow the first time ever for me lol

10 August 2015 - 05:40 PM

Seriously - Skullcap is anyone know what is it is - it's leaves that can make sedative tea for easing nervousness and anxiety. Such as passion flower etc - it's no where as roofies. I passed a joke saying, "Skullcap is a great sedative - just ask my ex-girlfriends lmao" and suddenly I got you've been kicked from chat.


Really? I think the person behind the kick button must like that button too much.


I also passed a joke saying, "Slicer has gone slicing up some pizza lmao" and that was apparently fine.


Oh another thing I almost forgot - someone possibly misinterpret this: "Where the Eninem Jr at? I love to tease him so much that he gets over excited and nerd rages all over my face!" Apparently the dude didn't like my opinion on a few games and got mad over it. That's what I meant with nerd rage over my face - screaming at me face. Get it?


Sometimes people gotta just chill and take a deep breather. No one told me "SIc you're being sick - stop or you'll be punted out to another galaxy. "


So what gives?