# EvilWeebl

Member

84

1. ## Swap limbs of a skinned mesh

If I have a model, such as a robot, I am able to swap its limb meshes out and replace them with other robot limb meshes by merely removing the limb mesh from the skeleton and attaching the new one to the appropriate bone.   Now I want to essentially do the same thing but with a skinned mesh, say a human/monster character. For example I want to swap a normal human arm for some bad-ass demon arm. How do I go about doing this as I believe I need to take into account skin/bone weights etc.   A great example I have found is the game Impossible Creatures
2. ## floating point precision problem

Hi all, More than just solving this problem I'd love if someone could explain to me the cause for this: I'm doing a winforms projects and have a picture box with an image. I drag a rectangle over that image and get the bounds of that rectangle. The thing is that I need to store these bounds as UV coordinates and as the picture box Y is at the top and UV's Y(or V) starts at bottom I need to flip them. I do this like so : return new RectangleF(bounds.X, 1.0f - (bounds.Height + bounds.Y), bounds.Width, bounds.Height); I should mention that X and Y range from 0.0000 - 1.0000. Now the problem occurs when I select most if not all the box and the equations looks something like: return new RectangleF(bounds.X, 1.0f - (0.9886 + 0.0114), bounds.Width, bounds.Height); Now obviously 1.0f minus this sum should make 0, but instead I'm getting -0.0000000158324838. Now I've seen that a float has a 7point accuracy but as you can see I'm not using that, so what is the problem? Any help would be much appreciated.
3. ## floating point precision problem

Ahh I see where I went wrong now, thanks for summing that up for me. Also laztrezort that link was a good read so thanks for that.
4. ## floating point precision problem

Thanks for the reply, Sorry I should have been more specific, the numbers I provided are examples of my bound.Height and bounds.Y values, bounds being another RectangleF so they will be floats and not doubles. Well It's not too important its just causing it to crash when I set some other values that rely on it clamped between 0 and 1 but as you say I can just clamp that myself. I was wondering if using decimal here would be preferable? Or at least casting them to decimal and then the resulting answer back to a float?
5. ## Negative exponential curve formula for stat leveling

But level 100 would be the maximum level, so whether it would continue to rise or not is not important as the character is capped at level 100. I realise that in my example to exponent is greater than 1, but changing the curve amount given a different exponent. a curve amount between 0 and 0.5 gives a positive curve and between 0.5 and 1 gives a negative curve. If anything this is a great help for defining growth rates of different characters. Am I right? Of all the googling I've done on rpg stat leveling formulae why haven't I come across anything like this? Makes me think I'm missing something.
6. ## Negative exponential curve formula for stat leveling

Hi all, I'm making a game where the character levels up and stats need to be increased. Now its a bit dull if every level got +1 for each stat so what I want is an exponential curve. The thing is I keep finding millions of things about making it start slow and get faster but can find sod all on the opposite, as in many rpg's you gain pace quite quickly and then at higher levels ease off. Now I'm not really an expert on this side of maths and have heard many terms such as negative exponential curve, logarithm etc. What I want is to take a min and max value and curve between them over 100 levels. Say at level 1 I want attack to be 1 and at level 100 I want it to be 1000, but at level 50 I don't want it to be 500, rather more like 600. I'm sure you understand. I've been trying formulas in wolfram alpha but not really getting anywhere. Could some one help me out. Any help much appreciated.
7. ## Negative exponential curve formula for stat leveling

Hi all, sorry I've been away so long. I just discovered something called Ken Perlin's bias that seems to suit my needs well and is adjustable on the growth. I am having a problem trying to fit in the base stat though so if I could get some help that would be great. This is what I have so far : stat(level) = (level/maxLeve)l^(log(curveAmount)/log(0.5)) * MaxStat In the following example the stat is 0 at level 0 and 500 at level 100. http://www.wolframal...)/log(0.5))*500 Now as I said I'm not sure where to be fitting the base stat into this equation to ensure it starts at say 50 but ends at 500. Any help much appreciated. Edit : actually could this be it? stat(level) = ((level/maxLeve)l^(log(curveAmount)/log(0.5)) * (MaxStat - baseStat)) + baseStat
8. ## Negative exponential curve formula for stat leveling

Wow such a lot of info to take in at once and I hardly understand any of it. Away from the computer at the moment but will look into it as soon as I can. Also I believe your right about logaritic curves not being for me as I checked them out and I did notice it can't be influenced between a maximum and minimum.
9. ## Android : import animation

Hi all, I want to build an animated character for a 2d game but I want the limbs to be interchangeable. Imagine like a cardboard puppet where all the limbs are attached by pins. In essence what I want is for sprites to be attached to an animated skeleton system, understandably this isn't possible and I definitely don't want to be manually animating the character. Instead what I figure is I'd make some planes in 3ds max or something and attach them to an animated skeleton. My question is how do I then import that into my android project and animate?
10. ## Assimp creating FileNotFoundException?

I have 3 projects in my solution; a native engine that produces a lib, a managed interface that uses that engine lib and creates a dll, and a managed Editor that uses that dll and accesses the engine through the managed interface. Ive recently been trying to implement assimp the asset importer into my engine and as soon as I have all the include and lib directories included and include the headers its all building and compiling fine. As soon as I try and utilise even the first bit of assimp my managed editor decides to through out this error at runtime: System.IO.FileNotFoundException: Could not load file or assembly 'ManagedInterface.dll' or one of its dependencies. The specified module could not be found. Its fine when I comment out the single line of code relating to assimp and runs perfectly but as soon as I uncomment it it will crash at runtime again. It's probably not directly significant but this is the line of code in my engine: Assimp::Importer importer; I figure it must have something to do with the way my include or lib directories are set up or something with assimp isn't getting built correctly. Any help would be much appreciated.
11. ## syntax error 'ID3DBlob'

I figured it thanks, I wasn't including the DX include and lib directories in my other projects. For some reason I always thought if you referenced the lib of a project that included the directories then it was ok but no, you have to set the directories up again for that project. It was in D3Dcommon.h though so thanks for your help.
12. ## syntax error 'ID3DBlob'

I'm building an Engine lib and have a function in my Engine.h that looks like this: HRESULT CompileShaderFromFile(WCHAR* szFileName, LPCSTR szEntryPoint, LPCSTR szShaderModel, ID3DBlob* ppBlobOut); This Engine project itself doesn't produce any errors but two other projects that access it by its lib produce the error: error C2061: syntax error : identifier 'ID3DBlob'. Probably a simple answer but I'm not very good with including libs and dll's and stuff into other projects.
13. ## Importing Engine.lib into other projects

We can forget this ever happened, consider this discussion closed. The libs weren't included in the linker *facepalm* Thanks anyway
14. ## Importing Engine.lib into other projects

Hi all, up until now I've been a 1 project guy but am now creating an Engine into a lib to be used by other projects blah blah etc etc. Any way for some reason the projects importing this are kicking up the following error: error C2061: syntax error : identifier 'ID3DBlob' with this line of code: HRESULT CompileShaderFromFile(WCHAR* szFileName, LPCSTR szEntryPoint, LPCSTR szShaderMode, ID3DBlob** ppBlobOut); //Private function in Engine.h If I take out ID3DBlob parameter it compiles fine until I call the function like so: CompileShaderFromFile("blah.fx", "VS", "vs_4_0"); then I get: Error 8 error LNK2019: unresolved external symbol "private: long __thiscall Engine::CompileShaderFromFile(wchar_t *,char const *,char const *)" (?CompileShaderFromFile@Engine@@AAEJPA_WPBD1@Z) referenced in function "private: void __thiscall Engine::InitPipeline(void)" (?InitPipeline@Engine@@AAEXXZ) C:...\NativeEngine_Sample\NativeGame\NativeEngineLib.lib(Engine.obj) NativeGame Can anybody help me solve this and explain why its happening so I know for future reference? Any help is much appreciated
15. ## Importing Engine.lib into other projects

Ok so I included the Directx include in the other projects and then included d3dx11.lib and the whole blobs error went away. I should have been more specific about that second problem it wasn't my helper function it was having the problem with it turns out its this directx function it doesnt like. D3DX11CompileFromFile(L"shaders.hlsl", NULL, NULL, "VShader", "vs_5_0", NULL, 0, NULL, &VS, NULL, NULL); it seems to be producing these errors in the projects that are importing the lib: error LNK2019: unresolved external symbol _D3DX11CompileFromFileW@44 referenced in function "private: void __thiscall Engine::InitPipeline(void)" (?InitPipeline@Engine@@AAEXXZ) C:...\NativeEngine_Sample\NativeGame\NativeEngineLib.lib(Engine.obj) NativeGame error LNK1120: 1 unresolved externals I've included just about every header that my lib uses such as d3d11.h, d3dx11.h, d3dcompiler.h, d3dcommon.h and yet still get same errors. Any ideas?
16. ## Importing Engine.lib into other projects

Thanks for the quick reply. Excuse my ignorance but which file? The engine.h file in my Engine lib or the files in the projects that are importing them? Im sure ID3DBlob is under ID3DX11.h which is included in my Engine lib project and compiles fine, its just the projects that import it are complaining. I presumed projects that imported the lib would also import the headers the lib is using, no? I have to #include all the headers again? It seems in the Engine lib project's external Dependencies it has D3DX11.h (hence I can #include it) but other projects that import the Engine libs are lacking it(although amongst the list seems to be most other DX headers). How do I add an external dependency? I'm sorry if these are brutally noobish questions but my experience is as much as starting a new project and going properties/include directory/ add DX. Also this solution was sent to me as a starting point and I have no idea how it was set up.
17. ## DX11 [DX11] Render scene to multiple windows

Hi all, I'm trying to create a level editor and haven't picked up directx since dx9. For simplicity's sake imagine that I have two windows that I need to render my scene to. It's the same scene but need to render it differently for each window i.e one with perspective camera, one with orthographic camera and in wireframe. I've seen a lot of different explanations of how to do this and these include using multiple devices, multiple swapchains and multiple render targets. Since this is all new to me could somebody shed some light as to the method I need to use and how to go about it? I cant seem to find any resources that explain how it all fits together and what each component(device, factory, swapchain, immediate context, render targets) actually do. If there was any information on this I might have a better understanding of it all and a chance to work it out myself. Any help would be much appreciated, thank you.
18. ## [DX11] Render scene to multiple windows

Thanks a lot, I had presumed that it must have worked as such for my situation. A very helpful reply and can honestly say I have no further question...for now Thanks again for all your help.
19. ## [DX11] Render scene to multiple windows

Oh one more quick question and then I'll stop bugging you for a while I promise. This is just so I know for later when I start some proper rendering. If in my scenario I have: 1 scene4 windows(1 is a perspective viewpoint and the other 3 are orthographic, wireframed and the cameras are set at different positions).This means I have 4 swapchains and their accompanying rtv's. Now let me know if I've got this wrong but wouldn't I have to set the rasterizer state on the device context to a solid state to render the first window and then have to change the rasterizer state to wireframe and render the next 3 windows? In which case doesnt that meant I couldn't use OMSetRenderTargets to set all 4 rtv's as they would all be drawn the same using only the rasterizer state that is currently set on the context? Would I have to individually set each rtv to the context using OMSetRenderTargets each time I rendered a different window? Ive seen that you can pass in multiple rtv's into OMSetRenderTargets at once so would it be possible for me to do that and yet still receive the desired different rendering for each window or would all rtv's be drawn the same? Thanks again in advance for any help you can give.
20. ## [DX11] Render scene to multiple windows

Thanks again Jason, again you've been quick and concise and have my gratitude. You've cleared up a lot about the pipeline for me, I wish it was easier to find such clear info elsewhere. I will get onto reading those articles post haste. You sir have earned yourself a 'like'. Much appreciated.
21. ## [DX11] Render scene to multiple windows

Forgive me for this nooby question but could you explain the purpose of the immediate context to me. As I am at the very start of implementing DX into my winform editor I merely have this to change the window to red: void Engine::Render() { float clearColor[] = {1.0f, 0, 0, 1.0f}; _ImmediateContext->ClearRenderTargetView(_RtvBackbuffer, clearColor); _SwapChain->Present(0, 0); } Am I correct in thinking I only need the one immediate context and if I wanted to render to two windows and different colours it would be as such: void Engine::Render() { float clearColor[] = {1.0f, 0, 0, 1.0f}; _ImmediateContext->ClearRenderTargetView(_RtvBackbuffer[0], clearColor); _SwapChain[0]->Present(0, 0); clearColor[] = {0, 1.0f, 0, 1.0f}; _ImmediateContext->ClearRenderTargetView(_RtvBackbuffer[1], clearColor); _SwapChain[1]->Present(0, 0); } Finally, and I'm getting ahead of myself here, but when I come to rendering models/simple triangles with vertex buffers; what is it that I need to alter to render in wireframe mode? As I understand it, its a rasterizer state that can be set on the device...but surely that would make all render targets draw in wireframe when I only want a certain window. I take it I set wireframe setting in a shader and render that swapchain rendertargetview separately with that shader? Oh and finally, finally, what is OMSetRenderTargets used for? Its used on all the samples I have, even the most basic directx11 tutorial where they only create the window and colour the window as I have with ClearRenderTargetView but mine seems to do the same job without it. My guess was that its sole purpose was to set the device to render to multiple targets at once yet all the dx samples use it and they only ever have the one window. Many thanks to anyone who could shed some light on all this for me, I really wish there were some better resources about for learning all this stuff.
22. ## [DX11] Render scene to multiple windows

Thanks Matt and Jason for your quick and helpful replies. It's a bit late in the day to be tinkering right now but I think you've set me along the right track. I'll have a fiddle and see what I can come up with tmw and post if I have any further questions. Oh and also I would like to mention how funny it is that only last week did I ask for your book to be put on my xmas wishlist and have a feeling it might be wrapped up somewhere in the house haha. If only I could find it there might not have been a need for this post after all. Many thanks.
23. ## Help using directx with winforms/wpf

You sir are a gentleman and a scholar. The single most helpful person I've come across yet. This is exactly what I've been looking for and you've set me on the right track. Thanks a lot.
24. ## DX11 Help using directx with winforms/wpf

Hi all, so I've been trying to make a level editor using winforms and xna(A total pain in the arse btw) but Ive decided that when it comes to importing the levels into the game itself I'd like the game to utilise the full extent of DX11. This makes using xna quite pointless as any effect I choose to use in the editor would be restricted to dx9. So with this I would like to use DX11 in the editor but still need a good UI environment such as winforms or WPF. The only thing is I've never really mixed managed and unmanaged code before so that's new to me. I see WPF uses d3d to render and can be adapted simple enough but also hear it might be a dead technology and also would require me learning that from scratch. My current level editor is winforms so thought maybe I could switch out xna for a managed directx like slimDX? That way I could still utilise dx11 rendering and exporting would be easier into native dx11 game. Basically I would just like any advice on which route to take, what your opinions are and preferably links to examples/tutorial/source code that could help. Thanks in advance for any help.
25. ## Help using directx with winforms/wpf

Thanks for the quick and very helpful reply. I guess I would prefer the B option. Ive worked with native directx before and is something id like to pick up again, also it would be more impressive as a portfolio piece. Also a good point that I wouldnt have to write the whole engine twice. My problem now is that I have no experience running native code in managed winforms, this whole c++/CLI thing is entirely new to me. Do you have any resources or info as to how to render to winforms using directx? P.S. I understand winforms have an aerospace problem with overlapping windows that MPF doesnt suffer from, is this a concern?