3D Nebula Graphics (How-to)

Yeah, Simsilica was nice because it’s not game specific but can easily be ‘game invoking’. It means ‘simulated sand’ so worked well with my initial ambitions but was abstract enough not to feel tied to them. (I figure it I ever make porn apps I’ll spin off Simsilicone for that. ;))

Simsilica was also nice because the molecule looks interesting enough to use as a logo. :smile:

…which even better is a screen shot of a JME model I created and so can be included at runtime as a 3D rotating model even. :slight_smile:

Awesome idea! And yea…Spaceship Game was just a working title til something jumped out at me. :smile:

What happens with this guys posts ???
Hacked ?
The translation of the edited text seens to be in latin, I could not translate right, hope its not offensive of something…

“Lorem ipsum” is pseudo latin and doesn’t mean anything: http://www.lipsum.com/

But it indeed seems strange that he changed a lot of his posts to this or withdraws them

@wagfeliz @Cervantez I’m so very sorry, I had this depression-infused self hate rage episode yesterday. Its safe to say that my posts on this forum aren’t the only thing I tried to ruin/delete, good thing that a lot of sites have a limit to doing that. Well I’m mostly back to normal-ish today and repairing the stuff I’ve broken - which extends to my apartment too :frowning:

I think I’ve recalled most of the the post withdrawals, and I’m restoring the OP posts now.

Wow, sorry to hear that. Glad you are back on track now.

@Topic:
I used this method in my space game and tweaked it a little bit:

Coloring

  • My nebulas have two colors (I use gray images as textures and color them via code)
  • The first quad I create is small and has the first color
  • From then on each quad is a bit larger than the last and its color is slighty shifted towards the second color. So the last and largest quad I create has the second color I defined

This way I can e.g. create magenta nebulas with a cyan core, which looks awesome

Motion

  • My quads slowly rotate in a random direction (clockwise or counterclockwise) at a random speed
  • They are also slowly “pulsing” in scale using a sine curve to periodically rescale them vom e.g. 95% to 105% with random speeds

Doing this the nebula look a bit more “alive”, because you cannot tell the different quads apart if each of them rotates and pulses at different speeds and in different directions.
But it is very important to keep the speeds low, otherwise they just look goofy. I set the speeds to a level, where you don’t notice the movement when flyting by, but can enjoy it when standing still and watching the nebula closely.

1 Like

Interesting idea, I just kinda do it randomly so It’s a uniform color, but I might try this out.

Tried that too, but that made it slightly weird while being were inside it. I added lightning strikes instead :stuck_out_tongue:

Ok, I just flew around until i found a good one (my quads are not centered at the same point and now some nebulas have their quads just too far scattered to be presentable :slight_smile: ):

And yes, I only have cyan/magenta nebulas right now :smile:

I have to check that. Actually I never went inside my nebulas since I implemented the movement :smile:

OMG! Lightning strikes!
I wanted to do those, too, but didn’t find a way that looked nice enough.
My first idea was to have a white cloud-quad in the nebula, which is culled. Then at random intervals I’d uncull it and cull it again a few millis afterwards. But that didn’t look good.
How did you do it?

BTW, if you use an image hosting site like imgur then it is really easy to post direct links that don’t come up as big blank boxes.

Blank boxes?

http://i.imgur.com/L9hFqg1.png

Though the first time I viewed the post they were giant full size empty boxes.

Hmm… They were shown correctly on my machine.
But I edited my post and uploaded them directly to the forum now. Hopefully it works…

Looks great, really really nice. I love this effect

In the most resource-consuming and straightforeward way possible.

Node lightning = new Node();
@Override
public void update(float tpf) {
	if(distanceToPlayer < someArbirtraryValue)
	{
		if(FastMath.nextRandomInt(0, 25) == 0)
		{
			float rand4 = FastMath.nextRandomFloat()/5-0.1f;
			float rand5 = FastMath.nextRandomFloat()/5-0.1f;
			float rand6 = FastMath.nextRandomFloat()/5-0.1f;
			
			String name = "light"+Integer.toString(FastMath.nextRandomInt(1, 2)) +".png";
			
			Material starmat = MakeWorld.nebula.get(0).clone();
			starmat.setTexture("ColorMap",CPU.game.getAssetManager().loadTexture("assets/celestial/nebula/"+name));
			starmat.setTexture("GlowMap",CPU.game.getAssetManager().loadTexture("assets/celestial/nebula/"+name));
			starmat.setColor("Color", new ColorRGBA(template.r+rand4,template.g+rand5,template.b+rand6,2f));
			
			Quad side = new Quad(nebulasize/8,nebulasize/8);
			Geometry plate = new Geometry("lightning",side);
			plate.setMaterial(starmat);
			plate.setQueueBucket(Bucket.Transparent);
			plate.setLocalTranslation(Methods.randomVector3f().mult(size/1.5f));
			plate.setShadowMode(ShadowMode.Off);		
			Node n = new Node();
			n.attachChild(plate);
			n.getLocalRotation().fromAngleAxis(FastMath.nextRandomFloat()*36, Methods.randomVector3f());
			n.setName("12");
			lightning.attachChild(n);
		}
	}
	
	for (Spatial spark : lightning.getChildren()) {
		if(Integer.parseInt(spark.getName()) > 0)
			spark.setName(Integer.toString(Integer.parseInt(spark.getName())-1));
		else
			lightning.detachChild(spark);
	}
    }
}

And afterwards I smiled like an idiot when it worked pretty well :smile:

The problem is that these strikes only appear for 12 frames and that makes it very very hard to take a picture of one. This also reminds me that this isnt framerate independant //TODO

Sounds like a job for a video! :slight_smile:

1 Like

That takes time to make. IF I HAD SOME.

What a great idea, thank you for posting!

Hey no problem, just make sure to read this as well: [Solved in year 2026] Optimizing a transparent mesh?