EnvironmentalVisualEnhancements icon indicating copy to clipboard operation
EnvironmentalVisualEnhancements copied to clipboard

Normals + Ramp

Open NathanKell opened this issue 11 years ago • 22 comments

I note that at present the scaledspace planet shader supports neither. Do you plan to support either? If not, I'm not going to bother shipping normals with RSS, that's for sure! :)

NathanKell avatar May 28 '14 07:05 NathanKell

I'm not sure. The existing Normal method with stock KSP makes craters on the dark side light up. So the maths would have to take care of that. It was on my to-do list though.

rbray89 avatar May 28 '14 14:05 rbray89

I would have thought a reasonable implementation would still have the dark side with dot < 0?

NathanKell avatar May 28 '14 19:05 NathanKell

Usually as a cop-out the shaders calculate the normal (vertex+map) then dot, so you get odd effects with craters on Mun for example.

rbray89 avatar May 28 '14 19:05 rbray89

Even if you calculate the normal that way, I wouldn't have thought the map normal would influence the vertex normal enough to raise dot above zero for the dark side (or particularly the very dark side; edge cases are edge).

NathanKell avatar May 28 '14 19:05 NathanKell

It isn't super noticeable, but it is enough to make me complain about it. You can see it in action here in the left in the dark. The craters shouldn't be lit up like that. http://i1162.photobucket.com/albums/q527/transcendentape/KSP%20Share/munarchloc.png

rbray89 avatar May 28 '14 19:05 rbray89

Oh, I've seen it. It's way worse on RSS Earth, you can clearly see mountain ranges in the center of the dark side. I was just gawking at what kind of weird stuff they'd be doing to have that happen, since I wouldn't think a normal map would offset the vertex normal enough to allow for a >0 dot on the (very) dark side.

NathanKell avatar May 28 '14 19:05 NathanKell

Yeah... still toying on the best way to solve it. Will likely use dot(vnorm, lnorm)*dot(norm,lnorm)

rbray89 avatar May 28 '14 19:05 rbray89

Ah yeah. As to the other part of the question--will you be reenabling the ramp shading, or writing your own, or something else?

NathanKell avatar May 28 '14 19:05 NathanKell

(Although I guess the first isn't viable since you're writing your own shader anyway. But I meant "doing something close to stock" vs. doing something different.)

NathanKell avatar May 28 '14 19:05 NathanKell

Not entirely sure yet. I don't think the ramping looks very nice to be honest. I'd rather have something designed to simulate proper atmosphere.

rbray89 avatar May 28 '14 19:05 rbray89

Well, there is AtmosphereFromSpace, although it seems like it's never used...

But you're quite right that the space-atmosphere shader needs some work (Jebified to MOAR BLUE!). :)

NathanKell avatar May 28 '14 19:05 NathanKell

Haha, I'm considering using an overlay mesh with a depth shader to emulate it.

rbray89 avatar May 28 '14 19:05 rbray89

Hmm. Would that work better than changing the planet shader and the clouds shader and doing pixel-based depth work?

NathanKell avatar May 28 '14 20:05 NathanKell

Well, effectively it would be a special "cloud layer" doing pixel-based depth stuff.

rbray89 avatar May 28 '14 20:05 rbray89

Yeah, I was just thinking that you might cut out the middleman and do it directly in the planet shader. (And, if necessary, the cloud shader too, although the clouds seem high enough that, going by the LEO photos I've seen, they're not that much affected).

NathanKell avatar May 28 '14 21:05 NathanKell

I was thinking about that, but I don't like how it wouldn't be able to extend past the planet's edges.

rbray89 avatar May 28 '14 21:05 rbray89

Ah, good point. Though at MEO and above the limb doesn't appear to extend past the planet's edge, and at LEO the AtmosphereFromGround corona is still going to be visible, and you can tweak that to handle it?

NathanKell avatar May 28 '14 21:05 NathanKell

If my plan works as I expect it to, I'll just remove it. :)

rbray89 avatar May 28 '14 21:05 rbray89

That could work too, of course!

NathanKell avatar May 28 '14 21:05 NathanKell

Another note: despite your planet shader appearing to support specularity, that doesn't seem to get added in practice...?

NathanKell avatar May 30 '14 00:05 NathanKell

It does support it. It isn't as glaring though.

rbray89 avatar May 30 '14 02:05 rbray89

Ah. Because even with full-255 alpha, Earth's oceans look matte... :\

NathanKell avatar May 30 '14 03:05 NathanKell