Jump to content

  • Log In with Google      Sign In   
  • Create Account


Murdocki

Member Since 30 Jan 2010
Offline Last Active Feb 16 2014 05:37 AM

Posts I've Made

In Topic: OpenGL terrain

17 January 2014 - 01:00 PM

You could have a look at texture splatting.

If you use all four channels of a splat/detail texture you can have four types in a single base texture, resulting in four possible textures. I'm using two splat textures so i can have up to eight different textures applied to the terrain. This is more than enough for a single terrain patch.


In Topic: Sun Shadows

16 October 2013 - 04:43 AM

Usually you dont see the entire world, so you can limit the area you have to include in your shadow map, thus increasing it's resolution. As with other rendering optimizations it's always good to not render what you dont see, meaning you only need to have shadows inside your player's frustum.

Using the sun's direction you can build an oriented bounding box around your frustum. You'll then have to extend that box in the direction of the sun so that it reaches all the way up to your scene/world's roof. This ensures that objects (a tree or tall building for example) that are outside of the player's view but are casting shadows into the player's view are still rendered into your shadow map.

If you extend the obb's size to the roof of your scene and the sun is at an angle(which is pretty much always) then you'll be extending a part of the obb outside of the scene's bounding box. This will lose you a little bit of precision, which you can solve by using a sheared matrix for the sun's projection.


In Topic: Downcast application registered interface.

01 October 2013 - 06:24 AM

I've been trying  to use the sharing but this doesn't work as good as i hoped. Sure enough i can access other classes, but with sharing i cant seem to reload scripts anymore. If i reload the dependant class first (scene main script) i get a message that it uses a type with a different layout than in it's original module. That's the 'order of compilation' thing i gues, so then i've tried recompiling the dependency first (test anim player), but that doesn't work either.

My reloading code works like this:

  1. Build a new module from the new source file with a new module name.
  2. Rename the new module to the old object type's name.
  3. Destroy instances of the old object type.
  4. Release old object type
  5. Start using the new object type from the new module.

There's a few missing steps like old module cleanup and recreating / synchronizing new object instances, but this is how i was supporting rapid prototyping on isolated entity behaviours.

My question now is: Is it actually possible to replace a shared object type?

 

I've stayed with 'sharing everything' instead of a single module because i dont see a way to add/remove/replace types on the fly when i'm using a single module.

Making all the inter-module communication happen through an abstract class (EntityBehaviour) is suboptimal as i would then have to add annother abstract class for the scene's main script (so that behaviours may talk back as well). I then also would have to create an elaborate messaging system. Since the EntityBehaviour is defined by the engine while all it's concrete implementations are defined by the game. I cant possibly put all the functions/properties of all the derivatives into the main abstract class.

I'd like to keep this messaging system as a last resort because i'd rather make direct function calls to other classes than send it some abstract message.


In Topic: Downcast application registered interface.

30 September 2013 - 03:59 PM

The script object returned by GetScriptBehaviour has it's reference increased prior to returning it, so i've been looking into the cast bytecode for the first cast (Script->EntityBehaviour).

It looks like i've got multiple versions of the EntityBehaviour type. the 'to' variable is 0x090d5c58 while the 'objType' derives from 0x04321fe8. The DerivesFrom function checks on pointer so the types indeed dont match.

 

My gues is that it has something to do with the contexts/modules. Every derivative of an EntityBehaviour uses a different context, and so does the scene main script (the one that's doing the cast). They also all are placed inside their own module.

I probably need to do something with the shared script entities. I dont think i can place all the scripts inside a single module, as the user should be able to add a new script even after the module has been compiled. If i make all the behaviours/derivatives 'shared' this should work right? The 'Shared script entities' page talks about order of module compilation, i gues this is no problem if i just include the files that contain the classes and not use forward declarations?(if they exist in as).

 

I've tried making the EntityBehaviour and TestAnimPlayer shared, this makes the casts work and i can call a function on the object. Is this a stable solution or am i misusing something? I dont fully understand modules/contexts yet, do i need to solve anything there or is this okay?


In Topic: [GLSL] Draw a textured (RGBA) polygon with opacity

15 October 2012 - 01:36 AM

I am wondering about this as well. If you are just passing through the uniform how can it even be interpolating. The same value for every vertex in a triangle should effectively disable interpolation right?

PARTNERS