necro1895

Member
  • Content count

    15
  • Joined

  • Last visited

Community Reputation

165 Neutral

About necro1895

  • Rank
    Member
  1. Does that work partly? Or do you test just the whole setup? Try to draw each separate part on the screen. I had also black screens, but that was because of the culling mode. Try to add this to your shader [CODE] pass Pass1 { CullMode = CCW; //<--- this or CW VertexShader = compile vs_3_0 VS(); PixelShader = compile ps_3_0 PS(); } [/CODE]
  2. Hy there, i'm working on a small techdemo and i implemented the deferred renderer by cansin. Everything is working well so far. So i decided to modify it. I added a skysphere which is rendering onto a separate RenderTarget. The final compositing shader overlays every drawn element on to the SkyMap. [CODE] float4 Color = tex2D(Diffuse, input.UV); //gets DiffuseMap float alpha = 1; //calculate alpha if (Color.a < 1) alpha = 0; float4 Lighting = tex2D(LightMap, input.UV); //gets LightMap float4 Sky = tex2D(SkyMap, input.UV); //gets SkyMap //float4 output = float4(Color.xyz * Lighting.xyz + Lighting.w, 1); float4 output = float4(Color.xyz * Lighting.xyz + Lighting.w, 1) * (1 - alpha) + tex2D(SkyMap, input.UV) * alpha; output = float4(Color.xyz, 1) * (1-alpha) + tex2D(SkyMap, input.UV) * alpha; return output; [/CODE] As you can see i dont allow smooth alphavalues. They just can be 0 or 1. This kind of masking produces some outlines around every drawn object. I dont want that. You can see this behaviour on the attached screenshot. I know from blender, that this could be a problem with premultiplied values. But i dont know how i can do that in HLSL. So please give me some advices. Thats disturbing me.. [img]https://lh5.googleusercontent.com/-woTFGhNPMEI/UBVqV6fd8II/AAAAAAAABAA/hlbWLbhugGs/s1477/3.png[/img]
  3. Yet another BoundingFrustum-Thread

    [color=#000000][font=arial, sans-serif][size=3]After playing around with some matrices i didnt find any matrix which fits the bounding frustum cube. The first one is the inverted matrix of view * projection. The second one was computed by xna via boundingFrustum.Matrix. [/size][/font][/color] [color=#000000][font=arial, sans-serif][size=3]The screenshot shows the frustum on the start position. I freezed the frustum for strafing rightwards.[/size][/font][/color] [color=#000000][font=arial, sans-serif][size=3]Whats wrong with these matrices? There are in no cases a trapezium. [/size][/font][/color] [color=#000000][font=arial, sans-serif][size=3]Btw, i got the same matrix without inverting the view*projection matrix like the frustum matrix. There is something really odd with that. [/size][/font][/color] [color=#000000][font=arial, sans-serif][size=3]I'm using this[/size][/font][/color] [color=#000000][font=arial, sans-serif][size=3][CODE] cubeFrustum.Initialize(Matrix.Invert(camera.matrixView * camera.matrixProjection)); [/CODE][/size][/font][/color] [color=#000000][font=arial, sans-serif][size=3]and this[/size][/font][/color] [color=#000000][font=arial, sans-serif][size=3][CODE] cubeFrustum.Initialize(camera.boundingFrustum.Matrix); [/CODE][/size][/font][/color] [color=#000000][font=arial, sans-serif][size=3]and they are calling these function:[/size][/font][/color] [color=#000000][font=arial, sans-serif][size=3][CODE] public static Vector3[] CreateCube() { Vector3[] cube = new Vector3[8]; int idx = 0; cube[idx++] = new Vector3(-1, 1, 1); cube[idx++] = new Vector3(1, 1, 1); cube[idx++] = new Vector3(1, -1, 1); cube[idx++] = new Vector3(-1, -1, 1); cube[idx++] = new Vector3(-1, 1, -1); cube[idx++] = new Vector3(1, 1, -1); cube[idx++] = new Vector3(1, -1, -1); cube[idx++] = new Vector3(-1, -1, -1); return cube; } public static Vector3[] CreateCube(Matrix _transform) { Vector3[] cube = EngineHelper.CreateCube(); for (int idx = 0; idx < cube.Length; idx++) { cube[idx] = Vector3.Transform(cube[idx], _transform); } return cube; } [/CODE][/size][/font][/color] [color=#000000][font=arial, sans-serif][size=3]It works for[/size][/font][/color] [color=#000000][font=arial, sans-serif][size=3][CODE] cubeFrustum.InitializeFromVertices(camera.boundingFrustum.GetCorners()); [/CODE] So i just dont understand, why its not the same as the formula above.[/size][/font][/color] [color=#000000][font=arial, sans-serif][size=3][img]https://lh3.googleusercontent.com/-M-jTVWzGZAI/T_xsLAsJKjI/AAAAAAAAA44/HsL5zlykrD8/s1477/+120710195143.png[/img][img]https://lh6.googleusercontent.com/-fCPGQoceN8s/T_xsMQghc2I/AAAAAAAAA5A/cvrdWEhp018/s1477/+120710195120.png[/img][/size][/font][/color]
  4. Yet another BoundingFrustum-Thread

    Nice formula, i will try that. I will compare the result of this with the computed frustum of xna -> frustum.getCorners() should deliver the same values.
  5. Your problem was, that your world1 and world2 matrices were identically all the time. Have a look at this. The queue of operations decides btw whether the matrices are doing their job correctly. You implemented the rotation with left/right. I guess its not working correctly atm. But first things first: Here is the code (just comment the world assignings out) [CODE] if (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Left)) { worldKutija = Matrix.CreateFromAxisAngle(Vector3.Up, 0.01f) * worldKutija; world = Matrix.CreateFromAxisAngle(Vector3.Up, 0.01f) * world; Window.Title = "Lijevo"; } else if (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Right)) { worldKutija = Matrix.CreateFromAxisAngle(Vector3.Up, -0.01f) * worldKutija; world = Matrix.CreateFromAxisAngle(Vector3.Up, -0.01f) * world; Window.Title = "Desno"; } else if (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.A)) { worldKutija = Matrix.CreateTranslation(Vector3.Left)* worldKutija; //world = Matrix.CreateTranslation(Vector3.Left) * world; } else if (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.D)) { worldKutija = Matrix.CreateTranslation(Vector3.Right) * worldKutija; //world = Matrix.CreateTranslation(Vector3.Right) * world; } else if (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.W)) { worldKutija = Matrix.CreateTranslation(Vector3.Forward) * worldKutija; //world = Matrix.CreateTranslation(Vector3.Forward) * world; } else if (ks.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.S)) { worldKutija = Matrix.CreateTranslation(Vector3.Backward) * worldKutija; //world = Matrix.CreateTranslation(Vector3.Backward) * world; } [/CODE]
  6. yah, the problem is, i dont see anything, and i dont have the time to get basic things up. How can i set up the test scene quickly?
  7. Where is the level-file?
  8. could you upload the project? Its hard to find bugs without the whole sourcecode.
  9. [CODE] be.EnableDefaultLighting(); be.DiffuseColor = boja.ToVector3(); be.SpecularColor = boja.ToVector3(); if (model == kutija) { be.World = (mesh.ParentBone.Transform * Matrix.CreateTranslation(pozicija)) * worldKutija; } else { be.World = (mesh.ParentBone.Transform * Matrix.CreateTranslation(pozicija)) * world; } be.View = view; be.Projection = projection; be.Passes[0].apply(); //new line [/CODE] Whats wrong with it? Does that not work?
  10. I dont know how to work with basiceffects, But actually you have to apply a pass of an effect. Maybe you can use something like be.passes[0].apply() after assigning the parameters to be. It seems, that every boundingsphere is using the same basiceffect-parameters.
  11. Are world1 and world2 are different after changing the positition of the active boundingsphere? If you render the inactive ones with world2 then the world2 has to be actually the Matrix.Identity-Matrix and world1 has to be Matrix.Identity with the position translation.
  12. Yet another BoundingFrustum-Thread

    Ok, i found out, that the Frustum is working correctly if i check the containment against a single point. So I'll have to do some researches about the BoundingBoxes. How annoying.. -.-
  13. Help with xna textures

    You copied the CODE but not the content like image files. Just drag and drop the image to your content project. Or click right mouse button on it and choose "add existing element". Pay attention to the LoadContent()-method.The relative path after Content.Load<Texture2D> has to be exactly the same as in your content-project.
  14. Redesigning the height generator

    [color=#000000][font=arial, sans-serif]The last days i worked on the terrain generator. I was not satisfied with the result of my unparameterized height-generator. Because there were no significant continents or mountains. So i decided to implement a node-based height-generator, which will gives me overall control of the generation process. [/font][/color] [color=#000000][font=arial, sans-serif]Node based systems are easy to explain. You have a source (or n sources) and a destination. Between these two points, there can exist 0..n modifier nodes which are modifying the incoming value. So i am abled to mix two noise-functions for getting a combined height value. Actually there are no restrictions in the number of sources, but of course you just have one output node. [/font][/color] [color=#000000][font=arial, sans-serif]In the screenshot below i used ridged-multifractal and perlin noise. They are scaled, got an negative offset and are added together in proportion 1 to 3. [/font][/color] [color=#000000][font=arial, sans-serif]I oriented myself on the blender node-system, which was a great inspiration. So i can also do easy mathematical operations like mix, add, sub, mul, div or trigonometric operations, ... [/font][/color] [color=#000000][font=arial, sans-serif]The whole power of this system can just be used, if there is a GUI like in blender. Today i tried to combine windows forms with the xna-GraphicsDevice. But unfortunately i have a design-lack on my planet-class, so i cannot use them in this windows form (yet). I will try to find a solution for that. Actually I'll need an xna-internal GUI, but thats very cumbersome and eats a lot of time. Because of finalizing my vacation tomorrow, i cannot really spend much time on that now. But i have to, because i need it. [/font][/color] [color=#000000][font=arial, sans-serif]The last point of interesting is the simple terrain-colorizer. Its just a simple pixelshader which colorizes the surface in depency of the height. If there is a GUI for the node-stuff, i will also parameterize the colors and tresholds. Planets with sand, grass, mountains are quite boring.[/font][/color] [color=#000000][font=arial, sans-serif]ToDos:[/font][/color] [color=#000000][font=arial, sans-serif]- Implementing atmospheric scattering[/font][/color] [color=#000000][font=arial, sans-serif]- Implementing frustum-dependent LoD (my current algorithm is slow and doesnt work quite well)[/font][/color] [color=#000000][font=arial, sans-serif][/font][/color]
  15. Necros planetary researches

    [color=#000000][font=arial, sans-serif]I'm doing some researches about the creation of planets. One cannot doing something interesting, and i have some problems with creating fractalized terrain. But the first step is done. Credits goes also to Brano Kemen (Outerra), who helped me out a lot. Probably he's the most brilliant head for that topic on this earth. [/font][/color] [color=#000000][font=arial, sans-serif][/font][/color]