P3D v4 Dynamic Lights Inside VC

I'm writing a PDK dynamic light like the custom lights example, works fine outside the aircraft. When I try to AddLight to a point inside the cockpit the code controlling the light is correct in the debugger and seems to be fine; the light never appears within the confines of the VC. Is there something I'm missing?
So found that there is a limitation with a dynamic light within a certain distance. Within 1 meter the light object isn't visible. Outside of that distance, it is visible. This seems to be related to a clipping limitation.
Thank you for the reply, I'll keep working on this, but the aircraft it was supposed to be implemented with will have to have the traditional cockpit lighting for now. Hopefully, the mystery can be solved and I can share what I have found here and on the P3D Developers Forum.
I have never had issues with interior lighting for P3D at any distance. Can you share the effect for testing.
Last edited:
In P3D v4 I created a dynamic light from the example given in the PDK, my impression was there wasn't an effect needed. The light would appear anywhere I positioned it as long as the camera was not within 1 meter of its location. Here's the draw call:

void DrawLight(IObjectRendererV400* pRenderer, ObjectWorldTransform& objTrans, ObjectWorldTransform& cameraTrans)
// get body relative offset of camera and light box
ObjectLocalTransform objToCameraTrans;
pRenderer->CalculateBodyRelativeOffset(objTrans, cameraTrans, objToCameraTrans);

// calculate heading offset
int headingOffset = int(abs(objToCameraTrans.PBH.Heading)) % 360;
if (headingOffset > 180)
headingOffset -= 180;

// Add White color in based on heading offset
unsigned int color = WHITE_COLOR | (headingOffset << 16);

// draw a group to hold the light

// add a light to the group
// X Y Z are positioning coordinates
pRenderer->AddLight(0.0, 0.656, 0.8, LIGHT_TYPE, color, LIGHT_WIDTH, 4000.0f, false);

// End the light group. Because it's attached to a sim object, sort this group
// to prevent drawing behind other transparent objects like clouds

//bool m_bDrawGroundLightGrid;
bool m_bDrawCockpitLightGrid;
int m_uOneSecondTick;

// default light type and width
const float LIGHT_WIDTH = 1.0f;
const unsigned int LIGHT_TYPE = 1;