Something Tasty...

Started by iWasAdam, May 10, 2019, 06:46:44

Previous topic - Next topic

iWasAdam

and now for something else that doesn't (at first glance) look very interesting...


So what is going on here then?
Well, each triangle in a an object can have a different shader. The above shows 2 faces with the same shader being applied. but the colors are completely different!

I've added the ability to feed data into a shader at the triangle level. This is currently 4 bytes. 1 has been designated color and you can see the new micro color selector. You get 32 base colors to play with and then 6 shades per color.
In the above test, data 2 is being assigned to the alpha of the texture and the micro color to the color of the texture. thus allowing for very fine grading of color and alpha.
Data 1 could be assigned to other data such as selecting different tiles from another fontsprite perhaps...?

GaborD

You are adding some really cool stuff. Really useful, can think of a lot of trickery to do with that functionality!

Matty

Interesting sliders.  Gave me ideas....which worked on first attempt.

iWasAdam

@Matty - great to hear yu'e got something that works they way you expected :)

@ GaborD I'm up for any suggestions??

iWasAdam

OK, todays update is something a bit more wierd...


taking it from the left to the right...
first we can see there is a mono bitmap being applied.
And the object is a cube
Finally we can see the output: it is taking the mono bitmap plus the triangle normal and creating a bump map! This is NOT a Normal map, nut a bumo map!

Another shot showing it with a more gradient sort of input:


So... Why bump mapping and not Normal mapping?
Basically... I couldn't get the Normal mapping to operate correctly. the bump mapping gives a much nicer result and also leaves scope for creating maps with other data layered into the Green and blue channels at the same time...

iWasAdam

quickly trying to replicate a real object:


the real thing on the left and the quick object created in about 2 minutes

it's sorta showing some promise :)

Steve Elliott

Coming along nicely Adam, good work.

Although the inner box should be white.   ;)
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

Derron

Bottom left corner shows some darker color - beveled corner or error in the lighting calculation?


bye
Ron

iWasAdam

Nah, just me not being careful when coloring the vertexes...

This was a bit more trouble though:


colored cube nothin interesting....
But... Top and left side are 'stamps' from the fontsprite and colored using the micro color picker. Alpha is inherent to the image. But the interesting thing is both have a variable procedural noise bump map as well. So the surface has some instant texture without using any other resources.
The right side is just a straightforward bump map from the fontsprite

GaborD

I really like the crispness.
Very cool layering btw, with the direct color controls it opens up a ton of possibilities.


iWasAdam

Thanks for that one :)

I was looking into muti-texturing (very simple) and wanted to use some for of secondary UV system. This meant going into the sources and adding - but wait.... there is already coord0 and coord1 being used! So I quickly check to see if 'my' code was using coord1 - NOPE  ;D This meant just a quick rewrite of the base code so that it could be accessed and voila:


This is a single face with a base orange color and a texture applied merging the color. Then the 037 is a second texture (from the same fontsprite) being over-layed with a custom alpha applied. I've still got 2 data parameters and a color parameter let to play with for bump mapping, etc....

Here's the base vertex code for a single triangle showing the data format:
Method AddVertexNormal2( tx:Float,ty:Float,s0:Float,t0:Float, s1:float, t1:float, color:UInt, xp:float, yp:float, zp:float, nx:float, ny:float, nz:float )
_vp->position.x=_matrix.i.x * tx + _matrix.j.x * ty + _matrix.t.x
_vp->position.y=_matrix.i.y * tx + _matrix.j.y * ty + _matrix.t.y
_vp->texCoord0.x=s0
_vp->texCoord0.y=t0
_vp->texCoord1.x=s1
_vp->texCoord1.y=t1
_vp->color=color
'jladded
_vp->color2 = _pmcolor2
_vp->xyzPosition.x = xp
_vp->xyzPosition.y = yp
_vp->xyzPosition.z = zp
_vp->Normal.x = nx
_vp->Normal.y = ny
_vp->Normal.z = nz
_vp+=1
End

so each vertex has xyz position, 2x texture coords, 2 colors (these can be set outside of the shaders and data can be used instead of color), a secondary xyz position, and a normal vector

iWasAdam

Maybe it's the engine pod of some long lost freighter...?  :o

Derron

#72
Either add self shadowing - or fade the texture of the exhaust darker.

Exception is of course if these are not exhausts but gates to a disco floor :-)

Edit: or just add the fuse-flames GaborD just posted these days. You know ... "just".

bye
Ron

Steve Elliott

Nice, and great for keeping the number of polys down.  But they do look wafer thin, and so not able to stand-up to any rocket flames.   ;)
Win11 64Gb 12th Gen Intel i9 12900K 3.2Ghz Nvidia RTX 3070Ti 8Gb
Win11 16Gb 12th Gen Intel i5 12450H 2Ghz Nvidia RTX 2050 8Gb
Win11  Pro 8Gb Celeron Intel UHD Graphics 600
Win10/Linux Mint 16Gb 4th Gen Intel i5 4570 3.2GHz, Nvidia GeForce GTX 1050 2Gb
macOS 32Gb Apple M2Max
pi5 8Gb
Spectrum Next 2Mb

iWasAdam

yep, more like:


I should add that all these comments do have some internal results:
First they point out where potential interest in things is.
And when working on getting a reply - the code does something odd or unexpected and I can fix it :)