Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

124 Neutral

About hawksprite

  • Rank
  1. hawksprite

    FFT Water Shaders

    I've been reading through that SDK and a few other tutorials online.   I think i'm making some progress but I still just don't understand the math behind it.
  2. hawksprite

    FFT Water Shaders

    So I started reading up on DFT, I believe I understand a decent bit of the formula now. Allthough I stick have a good bit to go. It isn't working but this is what I have so far: public float getWaveHeight(int index) { float t = Time.deltaTime; float x_n = waveVerticeList[index].x; float N = meshLength; // Total vertice count float e = 2.71828f; float i = Mathf.Sqrt (-1.0f); float k = index; float sub = (2 * Mathf.PI) * k * N; float DFT = x_n * (Mathf.Cos (sub) + i * Mathf.Sin (sub)); Debug.Log (DFT); // Fallback return DFT; } public void runComputeShader() { for (int i = 0; i < meshLength; i++) { waveVerticeList[i].y = getWaveHeight (i); } parentMesh.vertices = waveVerticeList; //parentMesh.RecalculateNormals (); } Is it even in the right path? I'm not 100% sure what i'm doing hahaha.
  3. hawksprite

    FFT Water Shaders

    Thanks for the links i'll read through those as well.   Will post my results later this evening.
  4. hawksprite

    FFT Water Shaders

    Thank you so much for the explanation of the variables.   It's saved me a lot of stress and bafflement.   Here's 5 e dollars good sir.
  5. hawksprite

    FFT Water Shaders

    So I've been trying to read up on it and I've googled around all day with no success.   I just can't figure out what i'm supposed to do for FFT.   I've been going off this paper:   http://www.limsater.com/files/ocean.pdf   But when I get to the equation for FFT there are variables like e that aren't referenced anywhere else, I have no idea what variables i'm supposed to pass to it.   Any help/insight would be greatly appreciated.   Thanks, Justin.
  6. I did some tests and here's what I found.   With rendering of the pixels on at a short distance (Not right up against it) I got about 42 F.P.S. with 500K particles.  Then when you got up close it dropped to about 20-15.   With rendering off (Also not setting the buffers to the shader material) It got the same 42 F.P.S. on average (It occasionally would go to about 70fps for a few seconds).  But didn't have the drop off when you got close to where they would be, which makes sense.   So there's a definite bottle neck with rendering up close, but there's also a definite 20 fps drop happening on the compute shader to just control the particles.
  7. So i've been toying with compute shader's to handle particle control and have run into an issue.  Everything is working fine so far but there's a bottleneck.  When I get up into the hundreds of thousands of particles it starts to lag, I haven't implemented other post processing effects on the particles such as blur and what have you so I'm concerned that there might be a serious performance problem later down the road.   I'll attach the script, shader, and compute shader.  I haven't done much optimization yet and i'm not sure how to properly use compute shaders so any advice you guys can give me would be greatly appreciated.  Thanks.   I just checked and it gets about 40-50 fps with 500k particles.   Part Controller: http://pastebin.com/zJ9C5Ehx   Part Controller Shader http://pastebin.com/GB24qttX   Part Controller Compute Shader http://pastebin.com/zTw6rVAN
  8. hawksprite

    Terrain Design (Mostly Mountains)

    For anyone reading through this thread looking for help with Unity Terrain I just found this toolkit that's helping me a crap ton.  The slop textureing feature is what I was missing in the built in terrain tools.   http://unity3d.com/support/old-resources/unity-extensions/terrain-toolkit
  9. hawksprite

    Terrain Design (Mostly Mountains)

      Thanks for the polycount link.  If things don't go well i'm probably going to look into a more procedural method for handling the terrain.
  10. hawksprite

    Terrain Design (Mostly Mountains)

    Currently my method is just making a general mountain shape with the terrain tools, then placing rocks on it and trying to paint on cliff textures to it.   Thanks for the advice, i'm going to do a bit of reading up on it later today.  
  11. I hope this is the right place to post this but anyways I've been having with terrain.  I've been working with unity and i'm trying to make a mountain.  My issue is making look like a mountain with the given height map tools.   It's driving me crazy because it seems no matter what I try it never looks anywhere even remotely close to other mountains.   I've come to realize that a large portion of the mountain is model based, however I'm not sure if it's one entire mountain or if theres a specific type of rock i'm supposed to somehow tile.   In the below image it appears that there's a base height map underneath, with some rock models sticking out of it.  What type of rock model would you use for this?   Sorry if some of this is a bit of a unorganized mess i've just been really baffled as to how to make these mountains look the way they do.  I've been trying with height map tools and a few rock for a couple days now and nothing I do looks anywhere near these mountains (I don't specifically mean skyrim I know that's a stretch but my mountains just look god awful).   Any help would be greatly appreciated. 
  12. hawksprite

    Getting started with C++

    True true, thats mostly while I decided to go with SlimDX for now but still plan on learning C++ in the future. Thanks for the analogy BTW, clears it up pretty well. Still, I think that saying that C++ is better for game programming is a very bold claim. There are some situations (e.g. developing the latest and greatest big-budget title, with cutting edge graphics being a selling point) where it is still necessary to use C/C++ for performance reasons. Also, sometimes the platform you are developing for (console/mobile etc) restricts your options. But for many of the games that an indie or hobbyist developer is likely to have the resources or desire to create, C++ is not the optimal choice as the same result can be achieved more quickly and easily by other means. Often the lack of a team of artists means that a small developer will naturally gravitate away from game ideas which depend on super-detailed graphical content, and instead focus on areas where they can be more competitive like original gameplay, story, stylised art etc. A not-so-terrible analogy would be cars. Is a Formula One car the best for driving? Really this depends on the situation (what sort of track surface? lots of corners or long straights? Are you driving around town? A rally car, Mini or drag racer might be superior in some situations) and also on the driver (what are they familiar with? I could probably drive my own little car around a track faster than an F1 car as I would spend most of the time either stalling or killing myself in the more powerful and complex machine). Having said that, I don't want to discourage you from learning C++ and getting deeper into things like memory management - it can be a lot of fun, is still the appropriate choice in some situations, and will improve the code you produce in other languages. Just reminding you that these things aren't black and white - c++ is just another tool in your toolbox to pull out when you recognise that it the right one for the job. [/quote]
  13. hawksprite

    Textured object is not appearing

    I have it working now i'll post the code below as a guideline for anybody having issues with this: [STAThread] static void Main() { var form = new RenderForm("Legends Among Men"); var desc = new SwapChainDescription() { BufferCount = 1, ModeDescription = new ModeDescription(form.ClientSize.Width, form.ClientSize.Height, new Rational(60, 1), Format.R8G8B8A8_UNorm), IsWindowed = true, OutputHandle = form.Handle, SampleDescription = new SampleDescription(1, 0), SwapEffect = SwapEffect.Discard, Usage = Usage.RenderTargetOutput }; Device device; SwapChain swapChain; Device.CreateWithSwapChain(DriverType.Hardware, DeviceCreationFlags.None, desc, out device, out swapChain); device.Factory.SetWindowAssociation(form.Handle, WindowAssociationFlags.IgnoreAll); Texture2D backBuffer = Texture2D.FromSwapChain<Texture2D>(swapChain, 0); var renderView = new RenderTargetView(device, backBuffer); var bytecode = ShaderBytecode.CompileFromFile("MiniTri.fx", "fx_5_0", ShaderFlags.None, EffectFlags.None); var effect = new Effect(device, bytecode); var technique = effect.GetTechniqueByIndex(0); var pass = technique.GetPassByIndex(0); var layout = new InputLayout(device, pass.Description.Signature, new[] { new InputElement("POSITION", 0, Format.R32G32B32A32_Float, 0, 0), new InputElement("COLOR", 0, Format.R32G32B32A32_Float, 16, 0) }); device.ImmediateContext.OutputMerger.SetTargets(renderView); device.ImmediateContext.Rasterizer.SetViewports(new Viewport(0, 0, form.ClientSize.Width, form.ClientSize.Height, 0.0f, 1.0f)); var textureView = new ShaderResourceView(device, Texture2D.FromFile(device, "picture2.png")); var stream = new DataStream(4 * 32, true, true); stream.WriteRange(new[] { new Vector4(-0.5f, -0.5f, 0.5f, 1.0f), new Vector4(0.0f, 1.0f,0,0), new Vector4(-0.5f, 0.5f, 0.5f, 1.0f), new Vector4(0.0f, 0.0f,0,0), new Vector4(0.5f, -0.5f, 0.5f, 1.0f), new Vector4(1.0f, 1.0f,0,0), new Vector4(0.5f, 0.5f, 0.5f, 1.0f), new Vector4(1.0f, 0.0f,0,0) }); stream.Position = 0; var vertices = new SlimDX.Direct3D11.Buffer(device, stream, new BufferDescription() { BindFlags = BindFlags.VertexBuffer, CpuAccessFlags = CpuAccessFlags.None, OptionFlags = ResourceOptionFlags.None, SizeInBytes = 4 * 32, Usage = ResourceUsage.Default }); stream.Dispose(); var view = Matrix.Translation(Vector3.Zero); var proj = Matrix.Translation(Vector3.Zero); var world = Matrix.Translation(Vector3.Zero); float zz = 0; device.ImmediateContext.InputAssembler.InputLayout = layout; device.ImmediateContext.InputAssembler.PrimitiveTopology = PrimitiveTopology.TriangleStrip; device.ImmediateContext.InputAssembler.SetVertexBuffers(0, new VertexBufferBinding(vertices, 32, 0)); effect.GetVariableByName("model_texture").AsResource().SetResource(textureView); effect.GetVariableByName("proj").AsMatrix().SetMatrix(proj); effect.GetVariableByName("view").AsMatrix().SetMatrix(view); MessagePump.Run(form, () => { device.ImmediateContext.ClearRenderTargetView(renderView, Color.Black); zz += 0.001f; world = Matrix.Translation(new Vector3(zz, 0, 0)); effect.GetVariableByName("world").AsMatrix().SetMatrix(world); for (int i = 0; i < technique.Description.PassCount; ++i) { pass.Apply(device.ImmediateContext); device.ImmediateContext.Draw(4, 0); } swapChain.Present(1, PresentFlags.None); }); bytecode.Dispose(); vertices.Dispose(); layout.Dispose(); effect.Dispose(); renderView.Dispose(); backBuffer.Dispose(); device.Dispose(); swapChain.Dispose(); }
  14. hawksprite

    Textured object is not appearing

    I've got a triangle to appear. Being newer to SlimDX my code is just a horrible mess of example snipets and crappy code holding it all together. But now i've hit another wall. I can make one triangle but im not 100% sure how to turn it into a more rectangular state then send the information needed to the shader to sample it as a texture.
  15. hawksprite

    Textured object is not appearing

    No I haven't. Would that be the device's Rasterizer? If so what should I set it to. Edit: I believe I set the state now but no changes to the cull mode made the object appear: RasterizerStateDescription rsd = new RasterizerStateDescription(); rsd.FillMode = SlimDX.Direct3D10.FillMode.Solid; rsd.CullMode = CullMode.Front; TextureDrawer.TextureDevice.Rasterizer.State = RasterizerState.FromDescription(TextureDrawer.TextureDevice, rsd);
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!