• Content count

  • Joined

  • Last visited

Community Reputation

697 Good

About montify

  • Rank
  1. The benefits of index buffers

      Drawings are ok :) but I understand the concept of index buffers. The problem was just about what happens if you add more data to a single vertex like texture coordinates and vertex normal which makes more vertices unique. But for most .obj files (and based on the above comments), I start to see some v/vt/vn pairs which are reused, so I just use the index buffer approach by default (or let the user decide).     Normaly, when you use a IndexBuffer you try to avoid to submit two Vertices at the exact same Location.   So without a VertexBuffer it is nonsense that 2 vertices at the same Position have different Texture Coordinate, Color data.     Hope i understand your question at the right spot.    Sry, im not good in English ;)
  2. The benefits of index buffers

    The IndexBuffer defindes primitives by referencing the vertex data stored in vertexBuffer.   So without a IndexBuffer you need 6 Vertices to generate this "mesh":     That means you submit 6 Vertices to the GPU - for this case that is not much, but imagine you have a fully Scene with lots of meshes....   With a IndexBuffer in your pocket the Picture look like:     you only need 4 Vertices in the VertexBuffer for generating the same result.       So you use the IndexBuffer as a reference how the InputAssembler read the VertexBuffer to generate (in this case) 2 Triangles.   So the IndexBuffer tell to the InputAssembler like:   Hey, here you have a VertexBuffer with 4 Vertices, i gave you a reference how you can assembly 2 triangles with this 4 vertices, look:   For the first, you need   the First Item from the VertexBuffer (0) than you grab the second Item (1) and at least you need the fourth(3) Item from the buffer to form the First Triangle.   For the second Triangle, you need    The fourth Vertex(3). the second Vertex (1) and the third Vertex (2) to form the second Triangle.   So you must think, the IndexBuffer is more like a Blueprint to gave the IA the reference how connect Vertices - the benefit is you send less Data to the GPU   Sorry for the drawing, im not a professional, hope you can understand what i mean, feel free to ask.   For the pro´s, if this is complete garbage than GC.Collect() and tell me what i said wrong :) - always learning..
  3. Procedural Planet

    Hear a Video of the Scale.   A Man vs. Planet  :wub:
  4. Procedural Planet

    hey, thanks for answer ! ;)   @brain: nice Idea, but hard to develop. My goal is a Outerra like thing ;)     Here some new Screens (hope i fixed the lightning bug)
  5. Procedural Planet

    Thank you for answer!   My Planet is bigger than 10km - it's earth sized ( radius = 6000km )   i have no experience with Voxels, sorry :(
  6. Procedural Planet

    Hello, here 3 Screenshots from my Planet. This "Engine" is Multithreaded, and generates a Earth size Planet (~20cm at the lowest LOD-Level)   Tell me pls what u think, or anybody else who working on a similar Project?  
  7. C# is loading Outdated File

    Solved, i must save the .fx file in the .dll.    I added a Resource to my Solution now it works!
  8. i have a curious Problem... I try to read a File with: StreamReader r = new StreamReader("Content//spriteShader.fx"); It's a simple HLSL Shader File. So i write "return float4(1,0,1,1);" in the .fx file. I compile, run, everything is output well in the Console. Now i change the .fx file to "return float4(1,1,1,1);" i save and run the Program but the Output is still the old one "return float4(1,0,1,1);"! I look in the Build Folder an here i see ne newer File! So my Question is: why Streamreader is loading the Outdated File when in the Build folder is always the newer file ( this work!). The Solution is a Class Library not a Windows Application if this helps. Anybody have an idea? EDIT: when i make a space in the .cs file or another change and save the .cs File again, the newer file is loading! BuildAction: Compile Copy: Do not copy ( when i switch to Copy Always the problem is the same )
  9. Seperate GUi from GameLogic

    I don't know if this is the right way to do Binding, but:   i have 1 Interface IBinding.cs: public interface IBinding { event Action OnChanged; } Here is my DataBinding.cs public enum BindinType { OneWay, TwoWay } public class DataBinding { public DataBinding(TextBox source, IBinding desination, string property, BindinType bindinType) { var myType = desination.GetType(); var p = myType.GetProperty(property); if (bindinType == BindinType.OneWay) { source.OnChanged += () => { string tmp = source.text; p.SetValue(desination, float.Parse(tmp), null); }; } if (bindinType == BindinType.TwoWay) { source.OnChanged += () => { var tmp = float.Parse(source.text); p.SetValue(desination, tmp, null); }; desination.OnChanged += () => { source.text = p.GetValue(desination, null).ToString(); }; } } } now i can do like this: new DataBinding(textBox, gameScreen, "a property value", BindinType.TwoWay); As a said, i dont know if this is common or not, i tried it by myself to "recreate" Microsofts Binding in a easy way...
  10. Seperate GUi from GameLogic

    Hey guys, thx for answer!   I created my own Databinding class (similar to WPF) and now i can bind two variables with reflection, OneWay and TwoWay.
  11. Hello guys,    im in trouble right now, because i stuck on a ( maybe ) a simple problem?!     So i have a GuiClass.cs with in this class i create my Button/Textbox, all the GUI stuff.   So i trigger the button/textbox with a event like in WinForms. But i need to exchange Data tgrough different Classes without a reference.     For case2 i create Singleton Class with a Dictionary<string, Action>, now in the OhterClass i can register a event like:   EventManager.Instance.AddAction("test", () => a = 3); and in the GuiClass i can trigger this event like:   button.OnClick += () => { EventManager.Instance.TriggerEvent("test"); }; so i solved case2.   But now when i change  the variable in the OtherClass, how can i  transfer the new value back to the GUI-Class? I can create a second event in the EventManager, but is there a better way to do this? - case 1   And in general, is my approach a goad Idea? How do you solve to seperate GUI/Gamescreen,...     I dont use WPF/Winform i wrote my own Textbox/Button rendered with Direct3D.    hope you can help me :(
  12. thx for answer! i solve the problem.. i simply forgott to do the IF statement into the while loop! ;)   Anybody have a clue how i can port this into a shader(hlsl)? 
  13. I try to implement this Algorithm in C#/XNA Looks not complicated, but I get no result, so i decide to ask here on stackoverflow... My Implementation looks like: int round(float n) { if (n - ((int)n) >= 0.5) return (int)n + 1; else return (int)n; } private void Shadowmap(Texture2D hMap) { float MapWidth = hMap.Width * hMap.Width; var tmpData = new Color[hMap.Width, hMap.Width]; // Here i grab the Texture Data into a 2D Array var heightMapData = TextureTo2DArray(hMap); Vector3 CurrentPos = new Vector3(); Vector3 LightDir = new Vector3(); Vector3 Sun = new Vector3(128.0f, 512.0f, 256.0f); int LerpX = 0; int LerpZ = 0; for (int z = 0; z < hMap.Height; z++) { for (int x = 0; x < hMap.Width; x++) { //Set current position in terrain CurrentPos = new Vector3((float)x, heightMapData[x, z].R, (float)z); //Calc new direction of lightray LightDir = Sun - CurrentPos; LightDir.Normalize(); tmpData[x, z].R = 255; tmpData[x, z].A = 255; while (CurrentPos.X >= 0 && CurrentPos.X < MapWidth && CurrentPos.Z >= 0 && CurrentPos.Z < MapWidth && CurrentPos != Sun && CurrentPos.Y < 255) { CurrentPos += LightDir; LerpX = round(CurrentPos.X); LerpZ = round(CurrentPos.Z); } if (CurrentPos.Y <= heightMapData[LerpX, LerpZ].R) { tmpData[x, z].R = 0; break; } } } SetTextureData2D(hMap.Width, tmpData); }  What I'm doing wrong? the TextureTo2DArray() and SetTextureData2D() Function works perfectly because for testing I pass the original Data through and the output looks like the Input image! Best regards, Alex! :) Hope anybody can help me.
  14. Ocean Test

    Little Video: So, after long work i have a tiny result, i got the Projection Grid working. (For now the Grid work only on a flat Plane, i hope i get the Spherical Version running) I use the Ocean from Proland ( Eric Bruneton)