Fill Spectre v3.1

Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.

Got a cool project idea but nothing else? Put it in the project ideas thread instead!

Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.

Please read the full rules for more details.
User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Re: Fill Spectre v3

Post by Pixel Eater »

I can think of two ways the engine might manage the effect:
1. By sending the entire scene (minus any Spectres) as a texture to a shader which has been applied to each frame of the Spectre(s).
2. Or send a black scene with just the Spectres drawn in greyscale as a texture to a post-processing shader.

Going by what Graf has said in a recent feature request, option 1 won't be possible until the Vulkan renderer is ready. But that doesn't mean it would automatically work either without additional development which option 2 requires as well (but could happen sooner than Vulkan?).

I know it's not the same thing but you could substitute this as a placeholder in your mods until Fill Spectre gets the support it needs. It was my attempt at a sprite version of Fill Spectre so it won't suffer the drawbacks of the purple detection.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Fill Spectre v3

Post by Apeirogon »

I remember I see somewhere mod which draw monsters on player screen if it in player fov, like wallhack from cs. Probably on/in some marisa mod... video, more preciesly.
So technically, I think, its possible to turn in shader if spectre in player fov, and only at position of the spectre sprite on player screen. Of course if shader can "chew" posotion of a monster on player screen as coordinates for shader effect.
User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Re: Fill Spectre v3

Post by Pixel Eater »

Thanks for confirming that Apeirogon, all I had were suspicions from reading through wiki entries! And those tend to break my brain :lol:
The shader already knows where the monster is on the screen but through chroma-keying, which is the big conundrum :?
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Fill Spectre v3

Post by Apeirogon »

There are gutawer math library
https://gitlab.com/Gutawer/gzdoom-gutam ... ree/master
which have some lines which you can use for it, like
https://gitlab.com/Gutawer/gzdoom-gutam ... x.zsc#L165

I think I can help with it, but it require from me to remeber how handle with matrix and other stuff, since from last time I was considered equation more complex than "2+2=5" passed more than ten years.
Plus, mathematics =/= programming.
User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Re: Fill Spectre v3

Post by Pixel Eater »

Oh I think I see now: You want to have ZScript tell the shader where in 3D space the Spectre is and what rotation/scale to use. Then the shader will read from a texture containing the Spectre's sprite sheet, apply billboarding transformations and then lens the background using it's luminance? That would mean no more chroma-keying :D
Apart from the lensing part I had actually thought of that technique as a means to cure sprite clipping but decided it was too ambitious due to the number of sprites in the game and my poor maths. For one monster though it sounds pretty plausible!

Edit: Oh, and because the Spectre is see-through you don't even need to consider lighting! (Another reason I dismissed the sprite clipping solution).
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Fill Spectre v3

Post by Apeirogon »

Not exactly, say to zscript it, specter in this case, position on player screen, and then use shader on that piece of screen.
Because, I think, without changing/exposing to zscript inner gzdoom drawer, which almost impossible, draw() function cant use shader directly to actor SPRITE, only to/on piece of player screen where this sprite draws gzdoom itself.

Im not so familiar with ui functions, because I dont use them much....well, at all, and with gutawer math stuff, for same reason, so another potential problem here is, how check so that specter is in player fov. Maybe gutawer matrix already return what player actualy see......or maybe not. I have some thoughs how do so in game scope, every tick, but Im not sure this suits for ui scope, because mouse movement/player fov changing processed more ofthen than every tick. So....field testing required.
User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Re: Fill Spectre v3

Post by Pixel Eater »

Apeirogon wrote:Probably on/in some marisa mod...
Is this the sort of thing you mean? Marisa'a Mod Cause that would be cool :D
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Fill Spectre v3

Post by Apeirogon »

Not exactly what I remember, but at the second screenshot it draw hiden part of acid pool on screen, so I think it works same way. I ask her how she did it.
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Fill Spectre v3

Post by Apeirogon »

So, marise give me this link to her mod. I understood some part of it, but some part is a pure magic for me. I see there are sine and cosine with arctangents, but in total I cant realize what means what.

Okay, using my "pen and paper" IBM PC and laws of geometrical optics I get something. "static Vector3 WorldToScreen" return coortdinate of points relative to player/camera position/slope/pitch/yaw/etc. and "static Vector2 ToViewport", if you give to it vector calculated in WorldToScreen, return exact position of that point at/on player screen. But, in one pass it returns only one point.

So now I need to figure out how check can player see spectre or not using ui part of gzdoom, if it possible.
User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Re: Fill Spectre v3

Post by Pixel Eater »

As my neck cranes up at that looming wall of shiny code I can feel my once-trailing shadow slink beneath my feet :shock:
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Fill Spectre v3

Post by Apeirogon »

Pixel Eater wrote:I feel the maw of despair swalowing me...
Not all thats bad. If you know some actions over matrices this would be more easy to understand.

I figure out that marisas example was modified to her needs. It would have cost to me 600 euro, if I would buy mathcad to check what wrong with it. But I pirated it :roll:.
So, I fall back to gutawer code and at example of marisas code create my own. It works, but it have some BACK effect.
https://youtu.be/mGzd1Mt-4DA
Something with pitch, I think.
User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Re: Fill Spectre v3

Post by Pixel Eater »

I can already tell that's progressing nicely!

Let me know if there's anything I can do on my end :thumb:
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Fill Spectre v3

Post by Apeirogon »

If you know how calculate dimensions change of object, because of perspective, tell me.
I fix pitch bug/feature/beg-o-feature, and now last thing that needed is found a perspective "distortions". This needed to define area inside of which shader must apply.

Again, I think I can learn how to do so by myself, but this require enormous amount of time, because now I know nothing about it and from what side I must approach to it. Matrix and stuff I know because Im studied for an electrician and its was necessary to understand how solder two wires one to another :P .
But now Im a helpless baby in dirty diaper.



After I write this, I started to revise gutawer math stuff, and found out that he have template for perspective matrixes
Spoiler:
I can even define it, there are some tips about it. But I dont know what do next with it.
User avatar
Pixel Eater
 
 
Posts: 667
Joined: Wed Aug 02, 2017 12:31 am
Location: In between the Moon and you, between the buried and me.

Re: Fill Spectre v3

Post by Pixel Eater »

Are the variables going into the function (double fovy, double aspect, double zNear, double zFar) known by yourself/your code or are you unsure what to do with the returned values?
User avatar
Apeirogon
Posts: 1605
Joined: Mon Jun 12, 2017 12:57 am

Re: Fill Spectre v3

Post by Apeirogon »

Pixel Eater wrote:are you unsure what to do with the returned values?
This.

I found this book
https://www.amazon.com/Computer-Graphic ... 0136053580
at my native language, so now I have something like this
shader test.zip
(8.23 KiB) Downloaded 63 times
I commented it, so you should not have problems with send info to shader.

Its still rude and buggy/ged, and probably dont optimized, but I worked on it.
Post Reply

Return to “Shaders”