glowing objects...

Blitz3D Forums/Blitz3D Programming/glowing objects...

ICECAP(Posted 2005) [#1]
What is the quickest way of making an object glow?
I just want to make a sphere glow so it would probably be quite easy to do i was just trying to think of the easiest and best looking ways of doing it.

I thought of creating a plain facing the camera, and putting a fading ring. But the problem with that is if you get close to the sphere the glow doesnt follow the edges of the object.

Any advice?


Perturbatio(Posted 2005) [#2]
can't you just use EntityBlend with Add Blend mode?


asdfasdf(Posted 2005) [#3]
Could you put a light in it?


ICECAP(Posted 2005) [#4]
Well to be more spaciffic i am trying to glow a planet.

Perturbatio:
What do you mean exactly by EntityBlend with Add Blend mode?

Do you mean that i create another planet and change the blend mode?

If you do that, then it isnt a soft glow which is the sort of thing i was after.

Blitz Programmer:

Put a light in it? I am trying to create a halo around the edge, how would putting a light in it help?


Luke.H(Posted 2005) [#5]
Try full bright:

EntityFX Planet,1


MadJack(Posted 2005) [#6]
Create a quad (or just use a sprite), texture it with a glow ring image, set it to blend, parent it to your sphere and make sure the quad/sprite always faces your camera.

Alternatively, I think there's an example in the code library that handles this problem specifically - go look.

http://www.blitzbasic.co.nz/codearcs/codearcs.php?code=453


ICECAP(Posted 2005) [#7]
MadJack,
I have had a look at that but the moment you get closer than a certain point you can see it is just another textured sphere.

Hmmmmm

I will have a muck around and see what i can come up with.

Let me know if you come up with any other ideas.

Cheers guys.


jfk EO-11110(Posted 2005) [#8]
I'd vote for the sprite too. It will face to the camera no matter what. So you only have to make it intersect the sphere in the middle.
Additionally you can set the sprites entityblendmode to 3, so it will glow like in "glow".


Rroff(Posted 2005) [#9]
not sure how well it would work, but you could create a sphere at the same coordinates as the planet, flip the mesh normals (similiar method to cell shading) and scale it so that its a little larger than the planet, then use a sphere mapped texture immitating a soft glow (i.e. a fade from the center of the texture to the outer edges) (look at the teapot demo and texture in the mak folder for an example of the sphere mapping part) then use the blend mode advice above to make the sphere semi-transparent and glowing.

When I get back later today I'll mockup something quick to demonstrate what I mean as my instructions don't seem that clear to me.


Mustang(Posted 2005) [#10]

sphere mapped texture immitating a soft glow



Yup, sort of what I did while back:

http://www.blitzbasic.co.nz/Community/posts.php?topic=24135




D4NM4N(Posted 2005) [#11]
i made a planet glow once, i set the 3d object to fullbright and then put attached a sprite to it (allways facing thecamera) of a radial gradient, so the edge was visible around the 3d model.


Rroff(Posted 2005) [#12]
yeah something like that :D thats some nice work mustang.


MadJack(Posted 2005) [#13]
It sort of sounds like he wants something that won't fall over at close range - i.e. low earth orbit with the curve of the earth filling the screen and the atmosphere glowing on the horizon(?)


ICECAP(Posted 2005) [#14]
Yeah, thats the one MadJack.

I have been trying to do this for a while now and getting fed up with finding ways that half work.

I also have the problem where i cant seem to make the textures detailed enough at close range. But thats another problem entirely.


Rroff(Posted 2005) [#15]
yah

playing around flip normals are kinda redundant as you have to disable backface culling for the effect to really work.

sphere texture mapping is the way to go.


Storm8191(Posted 2005) [#16]
Icecap: you might consider making a larger-than-planet sphere, like before, but flipping the whole mesh, rather than just the normals. It might not be a complete solution but I think it'll be something you can work with. You might then make this extra mesh face the camera at all times, and if you created a texture that laid over the mesh properly, you might be able to have something decent.

I don't know, something like this seems very hard. I saw a glow demo in the code archives but it wasn't flexible at all, and had like no comments.


MadJack(Posted 2005) [#17]
I think it's a misnomer to call it a 'glow effect' - you're more looking for a volumetric/atmospheric effect.

I guess the parented sprite fx could work for long views, but once you came close enough you'd need to fade out the glow sprite and ramp up your 'volumetric' effect somehow. Now what that effect would be, I don't know.

Perhaps a series of mesh 'curtains' to simulate a volumetric atmosphere, set them to blend with a gradient texture so that the top of the curtains fade to nothing, and the bottom of the curtains are also faded before they clip into the planet surface. Write some code so that they fade as they get close to the camera - or rotate them away from camera to a constant distance.

perhaps fade in a second sphere (larger than the planet), with a tiled cloud texture.

As you get lower again, start to add some particle emitters for puffy cloud

Then use the good old fog technique to create a 'break' between the upper atmosphere and flying above landscape.


John J.(Posted 2005) [#18]
I once made a planet effect like what you are describing (my Space Game Engine). It includes a realistic outer glow around a planet, atmosphere effects (the blue sky begins to appear as you enter the atmosphere), clouds, and gravetational pull simulation.

Additionally, it includes two levels of detail for each planet (with automatic smooth transitions), intended for terrains you can explore while on a planet (not implimented fully yet).

Here's a screenshot:



I may upload the source if you think it would help any.


MadJack(Posted 2005) [#19]
John J

I'd be interested - might give Icecap some pointers too.


Rroff(Posted 2005) [#20]
I'd be interested too, I have my own system for planets but the atmosphere glow I have had some issues with, I have it working but its rather a messy implementation.


John J.(Posted 2005) [#21]
Here's the engine:


You may need to put this image file where the engine can find it:



Here's some sample code so you can get the idea how the engine works.
EngineInit()
EngineCamera(cam)
EnginePlanetLOD(.3*sc,.1*sc)

planet=PlanetCreate(sc#,.001)
PlanetCloudRadius(planet,1.02)
PlanetAngularVelocity(planet,.02,.04,.01)
PlanetLightsource(planet,light)
PlanetAtmosphere(planet,1.1,1.1,.9,.06)
PlanetAtmosphereColor(planet,60,80,255)
PlanetCloudSwirl(planet,.002,.006,.004)

;tmp.Planet=Object.Planet(planet)	
;EntityParent cam,tmp\Pivot

planet2=PlanetCreate(.2,0)
PlanetAtmosphere(planet2,0,0,0)
PlanetPosition(planet2,0,0,3)
PlanetLinearVelocity(planet2,.04,0,0)

tex1=LoadTexture("Media\tex0.bmp")
tex2=LoadTexture("planet\earth.tga")
tex3=LoadTexture("Media\detail.bmp")
ScaleTexture tex3,.01,.01
TextureBlend tex3,2
ScaleTexture tex1,.3,.3
;ScaleTexture tex2,.5,.5
PlanetTexture(planet,tex2,tex3)
PlanetTexture(planet2,tex1,tex3)


If you can't figure out how to get it working, I can upload a working example (2.5MB).

Hope this helps :)


ICECAP(Posted 2005) [#22]
Could you upload your 2.5 mb demo.
I couldnt seem to get it working.


John J.(Posted 2005) [#23]
No more webspace :(

I'll see if I can delete some old unused stuff.


John J.(Posted 2005) [#24]
I gave up trying to free up webspace, so I e-mailed it to you. Good luck :)


GR(Posted 2005) [#25]
I posted this in another thread that was asking a similar question so I'll also post it here:

There are some really good code examples in the code archives so it's a good idea to check it out if you are looking for something specific. Maybe these links will help you out:

quick planet glow without entityorder
www.blitzbasic.com/codearcs/codearcs.php?code=452

Glow Effect
www.blitzbasic.com/codearcs/codearcs.php?code=1351

Cheers.