Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 18 Apr 2013
Offline Last Active Yesterday, 11:33 AM

#5181079 OIT (Order Independent Transparency)

Posted by plainoldcj on 17 September 2014 - 01:19 PM

Maybe it's already sufficient for your application to sort the individual triangles back-to-front.

You can store the vertices statically on the gpu and issue a sorted list of indices in every frame,

for example. It's not too bad.


If you really need perfect transparency you may consider depth peeling.

It's a multipass technique and runs on older hardware.


The cheapest trick is to draw in any order and tell everyone it's correct.

Most people don't notice alpha-blending errors anyways :)

#5180843 Panning camera so object is at edge of screen

Posted by plainoldcj on 16 September 2014 - 04:29 PM

Think in terms of frustrum planes, not view rays.

You could try something like this, again using the right frustrum plane for example:

1. get the plane equation

2. cast ray R along x-axis to find object-plane distance

3. move camera along x-axis so that distance is 0

depending on the object or which bounding geometry you use you should

sample the distance at every vertex and use the minimum or something like that.

im not really sure what you are trying to do. after the camera translation the object

should still be outside the camera view, right?

#5178823 Orthographic projection causes artifacts

Posted by plainoldcj on 08 September 2014 - 04:29 AM

Hmm. To my surprise the problem disappears when I choose a sufficiently large negative value for the near clipping plane.

So before I set (znear, zfar) = (0.1, 100.0) for both the perspective and the orthographic projection matrix and the error

occurs. When I choose (znear, zfar) = (-100.0, 100.0) for the orthographic matrix everything looks fine.

I have no idea why. Since setting znear = -100.0 essentially doubles the viewing volume I would guess the error

becomes even worse!

#5153395 Karatsuba algorithm

Posted by plainoldcj on 13 May 2014 - 02:35 PM


could it be that you override memory? You could try
changing func(A, B, A) to func(A, B, C) and see what happens then.

A note on bignums: you mentioned that you use base 2. I think the typical
choice is base 2^n, where n is the number of bits in an int-value.
This simplifies things as you can add two digits using ordinary + operator

#5151574 why in many fps games player character doesnt talk?

Posted by plainoldcj on 05 May 2014 - 04:15 AM

Prey, anyone? Here's a link of the intro and it's first person dialogues: 


Tommy's voice adds tremendously to the atmosphere of the game.

Note that he often expresses feelings like fear and anger and doesn't scream "Hell yeah" on kill streaks or something like that.

He has a (minimal) background story, worries about his grandfather and his girlfriend and is not some generic hard boiled soldier.

I wouldn't say I identified myself with Tommy, I just enjoyed watching his story and help him with the shooting.


The voice acting was good and Tommy's voice was distinctive enough so I was at no point confused who was talking.

Image you play something like "Die Hard - the game". Would you be confused who's talking when you're character has the voice of Bruce Willis?

#5144750 Linked List vs std::vector

Posted by plainoldcj on 06 April 2014 - 10:10 AM

This issue is covered by a lot of good talks.
See by Stroustrup or
http://channel9.msdn.com/Events/Build/2014/2-661 by Sutter, using the
same example.

#5140305 Splitting a rectangle area into organic section.

Posted by plainoldcj on 19 March 2014 - 06:28 AM

I just want to give you the name voronoi diagram.
I've only seen the case where the "influence" of a point is the euclidean distance. That is, for each point p
of an input set you get a corresponding "section" (cell) which contains all points which distance to p is not greater
than to every other point of the input set.
So it doesn't actually fit your problem but I imagine there are other forms of the vornoi diagram which solve your problem.
Or maybe you find a way to make the borders fuzzy, don't know.
You're picture reminded me of this, so just use this term to google smile.png

Note, however, that most algorithms for voronoi diagrams compute a representation of the borders of the section, like a graph, for
instance. I could imagine that's not what you need.

If you just want to draw such sections, why not draw several predefined sections on top of each other? This should even work
with picking.
You could use metaballs to generate sections.

What are you trying to do, anyways? smile.png

#5107822 Is hacky code allowed in industry?

Posted by plainoldcj on 08 November 2013 - 02:02 AM

Read this: http://gamasutra.com/view/feature/194772/dirty_game_development_tricks.php

#5100218 Computational Geometry Algorithms to Determine Rooms in a Dungeon (or a Build...

Posted by plainoldcj on 10 October 2013 - 10:20 AM

The first step for solving this problem is defining the term 'room'.



Assuming it's not possible to do the grouping yourself in the editor, because you generate dungeons at runtime, I'd advice you to ask

the developer of this plugin. It looks like the dungeons are glued together from predefinied pieced anyways, so ask him to include

triggers for the 'glue points'. After all, you paid a lot of money for this :)

#5096604 Well Structured Code

Posted by plainoldcj on 25 September 2013 - 04:49 AM

I've always wondered how to write games in a way that it is easy to read and object oriented so that I can easily get and set a players health. [...]

So innocent smile.png

#5092713 Best free Unity3D modelling software?

Posted by plainoldcj on 09 September 2013 - 07:45 AM

Try Blender with Linux. Hopefully this solves your Intel driver issue.

#5092669 Screenquad vs compute shader

Posted by plainoldcj on 09 September 2013 - 05:16 AM

Profile both approaches?

#5087315 Programmer's "writer's block" and getting bogged down

Posted by plainoldcj on 19 August 2013 - 09:39 AM

Basically, I'm finding my head being a clusterfunk of ideas and can't seem to find a good place to start without getting bogged down. Does anyone have any advice for dealing with this?

Remind yourself to code fearlessly:
Create a new branch of your code to play with and simply start typing.
Don't try to come up with a perfect design first for all anticipated features.
You get the most valuable insights by actually trying to implement stuff!

#5086848 Generic Datatypes --Are Templates the Way to Go?

Posted by plainoldcj on 17 August 2013 - 02:29 PM

Okay, this is an paradigm for implementing containers that I recently came across:

struct list_item { list_item *prev, *next; };
struct list {
list_item* head; // list of list_items
void add(list_item* item);
list_item* get(void);

To have a list of objects of type, say, my_widget, you derive from list_item:

struct my_widget : list_item { /* inherits prev, next pointers */ };

Additionally, you derive from list to hide casting:

struct my_widget_list : list {
// note how my_widget_list acts as a filter
void add(my_widget* item) { list::add((list_item*)item); }
my_widget* get() { return (my_widget*)list::get(); /* safe cast, only my_widgets in the list! */ }

Okay, great! But you certainly don't want to write a XXX_list class for every possible type XXX by hand. Luckily these classes can

be easily generated with templates:

template<class T>
struct concrete_list : list {
void add(T* item) { list::add((list_item*)item); }
T* get() { return (T*)list::get(); }

Okay, the code has probably some errors in it, but you get the idea how to hide the casting

and get pointers to derived types.


By the way, list implementations like these are often(?) called intrusive lists.

So you can ask Google how other people solved this.

#5083518 Dynamically Subdivide a Cubic Bezier Curve

Posted by plainoldcj on 06 August 2013 - 04:50 AM



for the planar case I tried a method called "Chaikin's corner cutting scheme" to subdivide a polygonal path,

which converges to the quadric b-spline defined by the path.

See for instance this link. I attached an image as an example, just because it looks really nice.

Subdivision schemes like this are really easy to implement and you don't have to worry about math.


There are, however, certain limitations of subdivision schemes. For my purposes I needed to regularly

texture the curve. I wanted to place little dots on the curve with constant spacing between them which

I was unable to do using a subdivided mesh.


So I found it easier to work with the analytical representation of a bezier curve, ie. with it's control and

endpoints. You then build your mesh by sampling the curve. Here's a great resources for the  "programmer's math"

of bezier curves!

If you are just interested in cubic bezier curves you can simplify the math in a lot of places.

"Subdividing" a curve is then a matter of increasing the sampling rate. 

Attached Thumbnails

  • subdiv.png