Avatar Lighting - Examples

rated by 0 users
This post has 9 Replies | 3 Followers

Top 100 Contributor
Posts 34
SunBurn_Community_Licensee
SunBurn_Pro_Licensee
Matt L Posted: 02-20-2010 12:46 AM

What's the current state of the Avatar Lighting system?  Is it working (as in the demo's) with the current SunBurn release?  I've seen several avatar classes in the api,  but can't find any examples on how to use them,  could someone provide an example on how to add an avatar to the sunburn scene?   Assume the avatar is already created and works under XNA,  how would I go about adding the environment lighting?

Top 50 Contributor
Posts 136
SunBurn_Community_Licensee
SunBurn_Contributor

Hey Pixel,

I've been working on integrating avatars into my game as well and from what it looks like, all of the setup and everything is the same as the normal XNA sample but instead of drawing it yourself, you submit it to the avatar manager (which is created if you set the 2nd parameter in CreateDefaultManagers to true). After that, all the lights submitted to SunBurn will have an effect on the avatar.

Top 100 Contributor
Posts 34
SunBurn_Community_Licensee
SunBurn_Pro_Licensee

Hi Raphael,

Thanks for the information.   I have set the useavatars bool to true in the create default managers.   How would I go about sending it to sunburn however?  Do you have a code example for this?

Thanks

 

 

Top 100 Contributor
Posts 34
SunBurn_Community_Licensee
SunBurn_Pro_Licensee

For anyone wondering how to add your avatar to sunburn,  the following example does fine.

Pretty straightforward and I should have seen this sooner - hopefully it will save people some time.

Create a function to add the avatar to your sunburn scene like this:

 

 

public void AddAvatar(AvatarRenderer avatarRenderer, AvatarDescription avatarDescription)

{

 

Avatar avatarObject = new Avatar(avatarRenderer,avatarDescription);

sceneInterface.AvatarManager.Submit(avatarObject);

}

 

Top 50 Contributor
Posts 136
SunBurn_Community_Licensee
SunBurn_Contributor

Cool, sorry I didn't respond earlier but it looks like you figured it out. =)

You probably want to return the Avatar object from that AddAvatar function so that you can modify it/work with it after you've created it.

Thanks for posting the code!

Top 50 Contributor
Posts 136
SunBurn_Community_Licensee
SunBurn_Contributor

Hey John,

I finally got avatars worked into my game but I've noticed that my point light doesn't cast the avatar's shadow when it's within a certain distance of the avatar. Do you know why that would be the case? Is there a parameter I should be setting?

It's working super so far! =)

Top 10 Contributor
Posts 5,368
Employee
SunBurn_Studio_Licensee

Hi Raphael,

I think that's related to how avatar shadows are rendered.  We're limited in how we render the shadows because the avatar renderer does not support shadows, allow custom rendering, or custom shaders.

But we'll definitely try to minimize this - though luckily it seems like a relatively small area is affected (~1.5x the avatar bounds?).

Follow me on Twitter – development and personal tweets
Awesome XNA Videos – Lighting, Rendering, and game videos

Top 50 Contributor
Posts 136
SunBurn_Community_Licensee
SunBurn_Contributor

Ah okay. Yeah, I have a point light that follows my avatar around but when it gets too close, the shadow just disappears completely. Maybe I can do something to fade just the avatar shadow in and out from that distance. Thanks!

Top 10 Contributor
Posts 5,368
Employee
SunBurn_Studio_Licensee

Ah, good point - I didn't think of that.  Can the light be raised high enough, so when directly over the avatar it's still far enough above to avoid clipping the shadow?

Follow me on Twitter – development and personal tweets
Awesome XNA Videos – Lighting, Rendering, and game videos

Top 50 Contributor
Posts 136
SunBurn_Community_Licensee
SunBurn_Contributor

Yup, but if it's too high then the geometry around it don't get lit correctly relative to the light bulb. But that's a really good idea! I think what I might do actually though instead is to have one point light that's raised high and casts shadows and a second one that doesn't cast shadows but is placed correctly. I'll have to try that tonight. =)

Page 1 of 1 (10 items) | RSS