ID:2375073
 
It's been a really big week for development. I wrestled with the decision of whether to put out a release today or not, but when it came down to it I realized I have a few things yet to investigate and button up, and on top of that some big changes have come through that make me leery of a Friday release.

So, first thing: I've been making noise about wanting to make Dream Maker use the hardware graphics renderer, so that I could someday completely 86 the software renderer. There are about half a dozen complex steps in that process, but the very first step was to move all the rendering code from the client to the byondwin library. That was more annoying than I anticipated, but in the end it all worked out. This of course is one of the major reasons I'm waiting on the release, because it's a pretty big structural change. I'll yank out the client code once the dust settles.

One of the next big things to come up was a new filter. I've wanted for a while actually to have a wave distortion filter, and I decided the time had come.


That's Lode Wars with a quick plane master thrown on with five animated wave filters.

So the gist of the new filter is you specify a direction and period for the wave with x and y, a size (amplitude) for the max pixel distance to distort forward or backward, and an offset (phase). By animating the offset you can make the wave move, and having multiple waves in parallel makes a really nice watery effect. In the image above I probably should have gone with a longer period on all the waves, but this was just a quick example. The wave shader will try to handle 10 waves at once if it can, for faster processing.

With that implemented I'm already thinking there are a couple of options I might want: 1) It'd be nice to be able to tell the wave filter not to expand beyond its bounds and to reuse edge pixels as the sample instead of transparency when it's near the edge. 2) A sideways wave, a wiggle effect, might also be desirable. Therefore I'm kind of considering adding flags to this filter before I release it.

I discovered a couple of interesting things along the way, including a few nasty bugs related to filters and animation. So those will be out of the way for the next release.

Also on the subject of filters, I'm quite open to considering other cool filters. A bloom filter has been suggested before, although those are devilishly difficult and notoriously poor performers, so I'll have to give that some thought. But if you have a filter effect you'd like to use in your game, please let me know and I'll be happy to consider it. Bribes also help.

Finally, I also made a rather shocking discovery about memory usage that impacts games like SS13, and it means I'm going to have to embark on a project to deal with that. I'll elaborate more in this week's Patreon post for a look under the hood.

And on top of all that, I have a new idea for plane handling in 513 that I think is gonna be a big deal.

That's it for this week! Thanks everyone for being a part of this adventure, especially our Members, donors, and Patrons. Big things are coming!
This should look great on something like this:


For this, is a filter necessary or is it possible to do it by matrix?
For the latter, neither. That's a 3D transform and it won't be possible till 3D matrices are a thing.
In response to Lummox JR
This seems 2D to me:

In response to YURIRAMOS
YURIRAMOS wrote:
This seems 2D to me:


It's not, and of course it seems 2D to you. You are looking at a render of 3D coordinate space in 2 dimensions. You are actually transforming that 2D image in 3D space and the program is displaying the result as a projected 2D image. Photoshop uses 4x4 matrices for its free transformation tool.

BYOND has 3x3 matrices, which can do 2D affine transforms.

a b c | 1 0 0
d e f | 0 1 0
0 0 1 | 0 0 1


Lummox is considering implementing 4x4 matrices (or some variant thereof), which would allow 3D projection.

a b c 0 | 1 0 0 0
d e f 0 | 0 1 0 0
g h i 0 | 0 0 1 0
0 0 0 1 | 0 0 0 1
Hardware Rendering AND 2.5D? Good god Lummox you mad man
In response to YURIRAMOS
YURIRAMOS wrote:
This seems 2D to me:


Yes, what you did in that animation is 2D, but it is not a two-dimensional linear transformation (and no linear or affine transformation will transform Lummox's avatar to what you did in that image). Any affine matrix encodes an affine transformation, and affine transformations have the property that if L and L' are parallel lines, then after they are transformed by an affine transformation they will continue to be parallel (Provided they are still lines, of course. It's possible that one or both would be mapped to points instead).


I did it just by changing the width and height in the paint with a specific rule. Using only 2 dimensions. I know there's a way to do it using more dimensions, but you can also do it that way. Low resolution and pixelated to make my life easier in this demo.
I don't think it was ever claimed that it's impossible to do such a thing in only two dimensions (nor am I claiming that what you're doing is treated as purely two dimensional in whatever program you're using). The (implicit) claim was that a transformation involving perspective can be done in only two dimensions using linear or affine transformations. In fact, it can not*.

*Nor can it actually be done in any dimension using affine or linear transformation. You have to bring in perspective transformations to do that.
In response to Popisfizzy
[]

I made a mistake in the middle, but you can understand.
In response to YURIRAMOS
YURIRAMOS wrote:
I made a mistake in the middle, but you can understand.

Again, a 3x3 matrix cannot do what you are trying to do. A 4x4 matrix can. BYOND only supports 3x3 matrices at the moment.

Holy shit, learn to pre-calculus.
In response to Ter13
I did not use a 4x4 matrix to do this.
In response to YURIRAMOS
YURIRAMOS wrote:
I did not use a 4x4 matrix to do this.



If you think this can be done with BYOND's existing matrices, then do it. We're just trying to save you from wasting your time.
Yuri, there are basically two ways to do a non-parallelogram deformation of a rectangle: that is to say a trapezoid or an arbitrary convex quad.

Method #1 appears to be something close to what you're doing in the video: proportional transforms on a line-by-line basis that requires chopping the image up into pieces, combined with regular affine transforms like rotations that 2D matrices can handle. Or more succinctly, a program might be able to take four vertices and interpolate between them to get the texture coordinates. This however will never produce the right texture coordinates for a 3D perspective illusion, because nearer portions of the texture need to be larger. Method 1 is also harder to implement.

Method #2 uses a 3D perspective transform; this is what Photoshop does when you tell it to realign a rectangle to four new arbitrary vertices. It produces the correct textural results every time. The key to this method is that the object is assumed to have a certain reference Z coordinate z0; in Photoshop it's z0=1/3. When the transform is finished, the Z coordinate of each point is used as a divisor, so X and Y are scaled--relative to the center--by z0/z. So when a point is twice as far away as its reference Z, it's half the distance to the origin that it normally would be. This method works the exact same way a 2D transform does, except that the points are converted by the GPU from 3D space to 2D, and the texture interpolation works the same way.
In response to YURIRAMOS
You clearly do not understand what is being said to you. Would you like me to formally prove to you that parallel lines can not be non-parallel after a linear or affine transformation? Either learn about what is being said to you, or I will prove this trivial result to you.
I think there's a language barrier at play.
In response to Lummox JR
That's what I thought, I know there are 2 methods (maybe even more). What I did not know is how hard to code, costly and size is for machine. Thanks for the sane reply.
In response to YURIRAMOS
The good news is that once 3D matrices are available, it should be doable to rewrite the rendering code to use perspective transforms, since the GPU does this kind of transform natively.
http://i.imgur.com/7LbNbYm.gifv It's not like 3D is impossible in BYOND, this was done in 2016. With operator overloading, it's even easier.
In response to Somepotato
Those triangles have no texture. If they did, the perspective illusion would be shattered. That demo is merely warping triangles with affine transforms.
Page: 1 2