June 18, 2019, 07:18:13 PM

Author Topic: Something Tasty...  (Read 1745 times)

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1110
Re: Something Tasty...
« Reply #60 on: June 09, 2019, 12:37:59 PM »
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...?

Offline GaborD

  • Sr. Member
  • ****
  • Posts: 283
Re: Something Tasty...
« Reply #61 on: June 09, 2019, 07:53:29 PM »
You are adding some really cool stuff. Really useful, can think of a lot of trickery to do with that functionality!

Offline Matty

  • Hero Member
  • *****
  • Posts: 646
    • MattiesGames
Re: Something Tasty...
« Reply #62 on: June 09, 2019, 08:47:17 PM »
Interesting sliders.  Gave me ideas....which worked on first attempt.

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1110
Re: Something Tasty...
« Reply #63 on: June 10, 2019, 11:16:00 AM »
@Matty - great to hear yu'e got something that works they way you expected :)

@ GaborD I'm up for any suggestions??

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1110
Re: Something Tasty...
« Reply #64 on: June 10, 2019, 03:16:03 PM »
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...

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1110
Re: Something Tasty...
« Reply #65 on: June 11, 2019, 08:57:55 AM »
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 :)

Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 1802
Re: Something Tasty...
« Reply #66 on: June 11, 2019, 09:42:27 AM »
Coming along nicely Adam, good work.

Although the inner box should be white.   ;)
Windows 10, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).
MacOS Mojave, 64-bit, 8Gb RAM, CPU Intel i5, 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB.
Linux Mint 19.1, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).

Offline Derron

  • Hero Member
  • *****
  • Posts: 2154
Re: Something Tasty...
« Reply #67 on: June 11, 2019, 11:35:22 AM »
Bottom left corner shows some darker color - beveled corner or error in the lighting calculation?


bye
Ron

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1110
Re: Something Tasty...
« Reply #68 on: June 11, 2019, 03:28:04 PM »
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

Offline GaborD

  • Sr. Member
  • ****
  • Posts: 283
Re: Something Tasty...
« Reply #69 on: June 12, 2019, 07:25:40 AM »
I really like the crispness.
Very cool layering btw, with the direct color controls it opens up a ton of possibilities.


Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1110
Re: Something Tasty...
« Reply #70 on: June 13, 2019, 10:58:07 AM »
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:
Code: [Select]
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

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1110
Re: Something Tasty...
« Reply #71 on: June 15, 2019, 01:00:09 PM »
Maybe it's the engine pod of some long lost freighter...?  :o

Offline Derron

  • Hero Member
  • *****
  • Posts: 2154
Re: Something Tasty...
« Reply #72 on: June 15, 2019, 01:16:09 PM »
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

Offline Steve Elliott

  • Hero Member
  • *****
  • Posts: 1802
Re: Something Tasty...
« Reply #73 on: June 15, 2019, 06:19:06 PM »
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.   ;)
Windows 10, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).
MacOS Mojave, 64-bit, 8Gb RAM, CPU Intel i5, 2.3 Ghz, Intel Iris Plus Graphics 640 1536 MB.
Linux Mint 19.1, 64-bit, 16Gb RAM, CPU Intel i5, 3.2 GHz, Nvidia GeForce GTX 1050 (2Gb).

Offline iWasAdam

  • Hero Member
  • *****
  • Posts: 1110
Re: Something Tasty...
« Reply #74 on: June 16, 2019, 06:51:52 AM »
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 :)