Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Oct 2005
Offline Last Active Today, 12:51 AM

#5181073 BSP trees with modern OpenGL

Posted by radioteeth on Yesterday, 12:56 PM

I just iterate through everything (game objects) I know that I know are visible and throw them into a separate binary tree (every frame) using their squared distance as each node's value with a pointer to the object. Then when I render, I just walk through the binary tree from furthest to nearest. FYI: The reason I used a squared distance to populate the tree is to avoid using a sqrt.

#5180013 BSP portal visibility

Posted by radioteeth on 13 September 2014 - 12:12 AM



The inner nodes of the tree only describe splitting planes, and the leaves themselves are the geometry formed by all the splitting planes. Convex hulls are formed, and where they are missing a polygon (a splitting plane is there instead) that is the portal shared with another convex hull.

#5170951 Basic Fluid Dynamics

Posted by radioteeth on 01 August 2014 - 02:18 PM

To be honest though, doesn't the SV_Position semantic go from [0, screenWidth] x [0, screenHeight] from the top left corner? If so, if there's a pixel at (10,10), the bottom one would be (10,11) and top (10,9), wouldn't it?


I know that OpenGL is flipped upside down (like TGA) where the bottom left is (0,0), I'm not sure about D3D though. In reality, it doesn't matter if you call it top/bottom head/toe, etc.. What matters is that the 'greater' value has the 'lesser' value subtracted - regardless of the orientation (semantics). In this case, you have the coordinate with (0,1) added, and (0,-1) added, to create two coordinates, and all that was happening here was you were subtracting the larger coordinate from the lesser coordinate, instead of the other way around.

#5170917 Basic Fluid Dynamics

Posted by radioteeth on 01 August 2014 - 11:22 AM

float2 bottom = PositionToTexCoord(input.position.xy + float2(0.0f, 1.0f));
float2 top = PositionToTexCoord(input.position.xy - float2(0.0f, 1.0f));


and you are doing


float div = 0.5f * ((r.x - l.x) + (t.y - b.y));


try swapping the +/- where you define bottom and top

#5163980 Inconsistent Sending of Data

Posted by radioteeth on 30 June 2014 - 10:15 PM

A long while ago I made a simple little open-world 3D fps shooter using TCP, sort of a warm-up project to learn the ins-and-outs of game dev in some sense, and discovered the hard-way that TCP "packets" don't always arrive just how they were sent.. They can arrive in fragments, or clumped together with other packets, which requires a method for extracting and reconstituting the original packets.. At least, for programs like multiplayer games. Otherwise, this 'streaming' setup works great for things like file send/receive actions. This might be the issue you are having.

#5163176 Latency in Wireless Connections

Posted by radioteeth on 27 June 2014 - 01:34 AM

I have a strange habit of assuming nearly-worst-case scenario with end-user situations. Hardware, internet, etc... and aim to make everybody as happy as possible, without disappointing those who are more invested in their setups.

#5161407 Share the most challenging problem you solved recently! What made you fee...

Posted by radioteeth on 18 June 2014 - 09:56 PM

I had an idea for a voxel polygonization technique (isosurface, etc..) about three years ago, and proceeded to get distracted by life up until just recently. My goal was to produce something similar to marching cubes but without fine displacement of vertices to approximate isosurface. The goal was to come up with an algorithm that isn't marching cubes.


The ultimate goal was breaking the problem down into simple steps. I finally figured it out, and it was ultra gratifying. I haven't felt accomplished like that in years!


I started a blog about my project, with a better explanation if anybody is interested. http://deftware.blogspot.com/

#5157422 how to access depth values in pixel shader?

Posted by radioteeth on 01 June 2014 - 04:06 PM

yes, just set up a texture using the depth attachment point in your framebuffer and it will have the depth rendered to it, then you can pass that texture into your fragment shader along with your existing texture.


Mind you that you are probably already using a renderbuffer with the depth attachment point, and that can be removed entirely and replaced with the depth texture you create instead, just pay attention to documentation about the format of your texture to make sure its compatible.

#5156023 What am I forgetting to optimize?

Posted by radioteeth on 26 May 2014 - 09:10 AM

1. Reducing the shadow map from 2048x2048 to 1024x1024 was the first thing that caused FPS to increase to 30

2. Having the camera amidst the exhaust particles caused lag, possibly because of sorting, but I don't see why sorting would need to do more work

3. Removing bump and specular on 200 units


But now the shadows are missing on the trees. A minor detail, messed something up.



 Whenever there is blending occurring multiple times over the entire screen, like when the camera is inside a bunch of particles, that typically causes a slowdown. Blending is expensive, which usually isn't a problem when it's only over a small portion of the screen. Especially since particles are drawn back-to-front, meaning there is lots of overdraw, which is unfortunately necessary for it to look right, but expensive!

#5155891 how to send RGBA unsigned byte color to GLSL shader?

Posted by radioteeth on 25 May 2014 - 11:15 AM


    glvertexAttribPointer(attribute, 4, gl.UNSIGNED_BYTE, false, 32, 12);





Wouldn't the 'normalized' parameter be set to 'true' so that the resulting byte value is scaled from 0-255 to 0.0-1.0 ?

#5155690 Packet combining

Posted by radioteeth on 24 May 2014 - 11:46 AM

You would include other things just the same way, so the first part of your packet is something like (for example) 3 bytes, one byte for how many entities are in the packet, one for how many events are in the packet, and one for effects.


Then the first byte of each entity (after an entity ID) is which properties of that entity follow.


After all the entities, and their info are in the packet, you move on to listing the events, then effects and their properties.

#5154853 my first gl 3 app: displaying a cube

Posted by radioteeth on 20 May 2014 - 11:45 AM

I see you have your 'box[]' array, but your glBufferData call references 'triangle' instead. And why is it trying to put 9 floats in there ?

#5154851 when do you kill an idea?

Posted by radioteeth on 20 May 2014 - 11:42 AM

I personally benefit from sharing my project with others (anybody, really) so as to bathe in their enthusiasm about it. Sometimes projects just get 'stale' once you've become so accustomed to their inner workings and the gameplay itself in general. It can become monotonous once you've experienced the relative gamut of possible game states as a problem space.


But the point of the game isn't so much the level of 'fun' of the core mechanic as it is the entire concept as a whole. You could make two games, identical in every way, with the exception of completely different graphical themes / appearance / motif, and surely one would seem more fun than the other, just because of the unconscious queues it presents players with.


Space games aren't fun because you are flying around with X number of degrees of freedom, but mostly just because of the idea of space itself being experienced (or simulated).


Even simple little mobile games can provide a more enjoyable experience with simple aesthetics.

#5153158 Perfectionism and Programmer's Block

Posted by radioteeth on 12 May 2014 - 04:44 PM

 Hi there. I wanted to query the collective knowledge and experience of those who haunt these forums in an effort to find relief from something I can only describe as programmer's block.


 I know what I want to make, but the knowledge about programming I've gained the past few years have only made it harder to get anything done without trying to do it 'right'. For some reason, doing it 'right' is taking precedent over getting it done. It becomes more of a chore, and less of a fun hobby.


 Just getting into OpenGL 3+ has become a daunting task, trying to implement a highly versatile rendering system capable of everything I can't forsee.


 That's just the issue though, the sense that I always code myself into a corner with projects, which has instilled a deep need to do everything as generalized, modular, and data-driven as possible. I feel I have taken certain programming tenets to extremes, yielding to nothing.


 I have heard things such as YAGNI (you aren't gonna need it) and KISS (keep it simple stupid) and I'm still struggling. How do I surrender!? What should I focus on. I just want to switch off this awareness I have gained, or at least tone it down, to where I can actually knock stuff out and enjoy doing it.


 Has anybody else struggled with knowing too much to be productive? I'm paralyzed!



#5151189 scanset's and zero sized results breaking parsing.

Posted by radioteeth on 03 May 2014 - 07:57 AM

try using Format[] = "%[^|]%*[|]%n"


That should consume all pipes for you.