Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


ic0de

Member Since 11 Nov 2010
Offline Last Active Yesterday, 06:16 PM

Posts I've Made

In Topic: fitting Geomipmapping into my existing tree system

02 December 2014 - 02:27 PM

Do you put the heightmap in the same data structure as the rest of the world scenery (buildings etc.) though?


In Topic: Problem with perspective in opengl

23 November 2014 - 01:44 PM

This doesn't look like a perspective problem, it looks like you're culling the wrong faces. Have you set glCullFace(GL_BACK)? If not that may fix your problem. You may also need to set glFrontFace(GL_CCW).


In Topic: getting better results with exponential shadow mapping

18 November 2014 - 11:40 AM

OK so after filtering my shadow map with a separable log space Gaussian blur and capping the shadow frustum far plane at the point where light fades to zero, I have started to see some improvement. I have determined that the problem originates from the fact that I appear to be getting less depth buffer precision for objects that are far away from the light. Shortening the distance between the near and far planes of the light frustum seems to combat this. I'm not really sure if I can shorten them any more, especially the near plane as I could miss objects between the light and the shadow receiver. As of now I'm not using any polygon offset, is this technique still relevant for ESM?

 

Anyways this is where I'm at now (although the lighting conditions are slightly different):

 

 

shadowfail2.png

 

Its better than before but occluders far from the light experience a far worse manifestation of this artifact.


In Topic: odd behavior with globally declared scoped reference types, is this normal?

22 October 2014 - 09:51 PM

Thanks for the amazingly quick fix. I know that new isn't guaranteed to be aligned but I overloaded the operator to ensure this as I was having trouble in other parts of application.

EDIT: tested your revision with my code and it works like magic, you really are a wizard.

In Topic: odd behavior with globally declared scoped reference types, is this normal?

22 October 2014 - 03:10 PM

Well it's real ugly but here it is, I'm using extensive macros and lambdas so I can declare wrapper functions inline and I apologize for the messiness. The crash still happens without the lambda approach.
 
//these do lambda magic to allow the definition of wrappers inline
#define WRAPFUNC(ret, args, body) asFUNCTION(static_cast<ret(*)args>([]args -> ret body))
#define WRAPEXPR(ret, args, expr) WRAPFUNC(ret, args, {return expr;})

void registerVec()
{
	r = engine->RegisterObjectType("vec", 0, asOBJ_REF | asOBJ_SCOPED); assert(r >= 0);

	r = engine->RegisterObjectBehaviour("vec", asBEHAVE_FACTORY, "vec @f()",				WRAPEXPR(vec*, (),			new vec()),		asCALL_CDECL);		assert(r >= 0);
	r = engine->RegisterObjectBehaviour("vec", asBEHAVE_FACTORY, "vec @f(const vec &in v)",			WRAPEXPR(vec*, (const vec &o),		new vec(o)),		asCALL_CDECL);		assert(r >= 0);
	r = engine->RegisterObjectBehaviour("vec", asBEHAVE_FACTORY, "vec @f(float nx, float nx, float nz)",	WRAPEXPR(vec*, (float x, float y, float z), new vec(x, y, z)),	asCALL_CDECL);		assert(r >= 0);
	r = engine->RegisterObjectBehaviour("vec", asBEHAVE_FACTORY, "vec @f(float n)",				WRAPEXPR(vec*, (float n),		new vec(n)),		asCALL_CDECL);		assert(r >= 0);
	r = engine->RegisterObjectBehaviour("vec", asBEHAVE_RELEASE, "void f()",				WRAPFUNC(void, (vec* t), {if(t)		{ delete t; }}),	asCALL_CDECL_OBJLAST);	assert(r >= 0);

	r = engine->RegisterObjectMethod("vec", "vec &opAssign(const vec &in v)",	asMETHODPR(vec, operator =, (const vec&), vec&), asCALL_THISCALL); assert( r >= 0 );

	r = engine->RegisterObjectMethod("vec", "vec &opMulAssign(const float)",	asMETHODPR(vec, operator *=, (const float), vec&), asCALL_THISCALL); assert( r >= 0 );
	r = engine->RegisterObjectMethod("vec", "vec &opDivAssign(const float)",	asMETHODPR(vec, operator /=, (const float), vec&), asCALL_THISCALL); assert( r >= 0 );
	
	r = engine->RegisterObjectMethod("vec", "vec @opDiv(const float) const",	WRAPEXPR(vec*, (float o, vec* v), new vec(*v / o)), asCALL_CDECL_OBJLAST); assert(r >= 0);
	
	r = engine->RegisterObjectMethod("vec", "vec @opMul(const float) const",	WRAPEXPR(vec*, (float o, vec* v), new vec(*v * o)), asCALL_CDECL_OBJLAST); assert(r >= 0);

	r = engine->RegisterObjectMethod("vec", "bool opEquals(const vec &in v) const", asMETHODPR(vec, operator==, (const vec &) const, bool), asCALL_THISCALL); assert( r >= 0 );

	r = engine->RegisterObjectMethod("vec", "vec &opAddAssign(const vec &in v)", asMETHODPR(vec, operator +=, (const vec&), vec&), asCALL_THISCALL); assert( r >= 0 );
	r = engine->RegisterObjectMethod("vec", "vec &opSubAssign(const vec &in v)", asMETHODPR(vec, operator -=, (const vec&), vec&), asCALL_THISCALL); assert( r >= 0 );
	r = engine->RegisterObjectMethod("vec", "vec &opMulAssign(const vec &in v)", asMETHODPR(vec, operator *=, (const vec&), vec&), asCALL_THISCALL); assert( r >= 0 );
	r = engine->RegisterObjectMethod("vec", "vec &opDivAssign(const vec &in v)", asMETHODPR(vec, operator /=, (const vec&), vec&), asCALL_THISCALL); assert( r >= 0 );
	
	r = engine->RegisterObjectMethod("vec", "vec @opDiv(const vec &in) const",	WRAPEXPR(vec*, (const vec &vo, vec* v), new vec(*v / vo)), asCALL_CDECL_OBJLAST); assert(r >= 0);

	r = engine->RegisterObjectMethod("vec", "vec @opMul(const vec &in) const",	WRAPEXPR(vec*, (const vec &vo, vec* v), new vec(*v * vo)), asCALL_CDECL_OBJLAST); assert(r >= 0);
	
	r = engine->RegisterObjectMethod("vec", "vec @opSub(const vec &in) const",	WRAPEXPR(vec*, (const vec &vo, vec* v), new vec(*v - vo)), asCALL_CDECL_OBJLAST); assert(r >= 0);
	
	r = engine->RegisterObjectMethod("vec", "vec @opAdd(const vec &in) const",	WRAPEXPR(vec*, (const vec &vo, vec* v), new vec(*v + vo)), asCALL_CDECL_OBJLAST); assert(r >= 0);

	r = engine->RegisterObjectMethod("vec", "void normalize()",		asMETHOD(vec, normalize), asCALL_THISCALL); assert( r >= 0 );

	r = engine->RegisterObjectMethod("vec", "vec @normalized()",	WRAPEXPR(vec*, (vec* v), new vec(v->normalized())), asCALL_CDECL_OBJLAST); assert(r >= 0);

	r = engine->RegisterObjectMethod("vec", "float magnitude()",	asMETHOD(vec, magnitude), asCALL_THISCALL); assert( r >= 0 );

	r = engine->RegisterObjectProperty("vec", "float x", asOFFSET(vec, x)); assert( r >= 0 );
	r = engine->RegisterObjectProperty("vec", "float y", asOFFSET(vec, y)); assert( r >= 0 );
	r = engine->RegisterObjectProperty("vec", "float z", asOFFSET(vec, z)); assert( r >= 0 );
}

PARTNERS