Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Fililip

Pages: [1] 2
1
I did not understand the math behind this, as it was not well explained, and was (probably) meant for people experienced in vector maths/trigonometry/whatever that branch of math is.

For example, what is the "T" component and what is its purpose, and how is the "direction" component calculated? Is it just an angle in degrees/radians?
And also, what's the deal with all these equation transformations?

If you could find any beginner-friendly or just well explained tutorials, I would be grateful.

And about that post you gave me a link to, there is no explanation on how it's made. And that doesn't help me since I would like to understand the math behind it and implement it based on that knowledge.

2
So, before I begin my question, I want to say that I can't find any good tutorials that would explain how all the math behind 2D raycasting works and how it is implemented.

I want to achieve that 2D shadow effect which can be found here: http://ncase.me/sight-and-light/

Can someone explain how this guy did it and how this math works so that I can implement it myself?

Any help is appreciated!

3
You can create an sf::Clock and check the elapsed time every frame. And after it reaches the timer threshold you want, you move your player quad and reset the clock.

Example code:
sf::RectangleShape player(sf::Vector2f(100.f,100.f));
sf::Clock timer;

//in the game loop
if (timer.getElapsedTime().asMilliseconds() >= 500)
{
    player.move(0, 5); // replace 5 with anything you want
    timer.restart();
}
 

4
I checked out this topic and it doesn't really explain how it's done (it's not a tutorial), and the only thing linked to it is the LearnOpenGL website which does not really help me understand how things work in 2D.

5
So which tutorials do you actually recommend that'll help me understand EVERYTHING that needs to be done to display these huge amounts of lights? I could not really find what I was looking for since most of them revolve around 3D and I'm not working in 3D, but rather 2D.
(Because if I understood the entire process correctly, deferred rendering (2D) is basically rendering the scene once, then all the lights by drawing circles, using a lighting shader on each one of them, and multiplying the result (or instantly drawing on one texture) to finally blit the finalized scene to the window's buffer.)

6
I was trying to learn how to do deferred rendering properly and since I don't really want to go 3D yet, I just wanted to try to implement it in 2D to see if I understood it correctly.
You know, I've been trying to understand deferred shading for like 3 weeks and I still think I did not implement it correctly. (I just could not get any help with my problem, and I've been looking for the solution everywhere)
The only thing I wanted to achieve was to finally understand how it should be implemented.

7
Okay, I figured it out. I had to render a circleshape for each light and use the lighting shader on it, rather than on the entire fullscreen quad for pointlights. Now I can safely render even 2000 lights in the entire window's viewport, at which I'm somewhat-starting to get 80 or lower FPS, but that's still good imo. (it may be related to my GPU being pretty good at this though)
But can I go even further than that about it? What sort of other optimization technique can I use to make this app handle even more lights (if that's possible that is) with even less of a performance impact?

8
General / Re: Erasing a certain area of a sprite on mouse click
« on: March 30, 2018, 10:22:44 am »
I think you have to modify the sf::Texture of your sprite and you'll see the changes automatically as SFML stores a reference to it, rather than a copy of it.
Dunno about how you'd delete a certain part of a texture though.

9
And also, how can I turn my lighting system into a deferred rendering one?
I get the main idea, but how are you passing lights to a deferred rendering shader?
The LearnOpenGL website has a fixed value of 32 lights in their example, and to me it isn't a better solution.
I would like to be able to render as many lights as I could think of without a big impact on performance.
So what's with the passes? How do they happen?

10
So how would I go about testing the performance of my application with the profiler?

11
I figured it out. It was the debug mode's slow performance. Compiling it in release mode improved the performance A LOT.
Now I can safely and efficiently handle even 400/500 lights without a problem.
My only question is: how did this guy () achieve such great results (10,000 lights and more than 10 fps)?

12
BTW, will culling work for this? (rendering only the light-affected surface)
If yes, how can I achieve it?

13
Sorry, I'm not really "prepared" yet to go deep into OpenGL (I'm a huuuuge newbie), I would really love to be able to make 2D games with just SFML.
As for the shader, I don't think it is the bottleneck, but rather drawing 500x the lights (which are essentially fullscreen quads, so it's like drawing to 500 screens at the same time) (am I right though?)
But I'd really like to make this effect with shaders because I know it can be done efficiently and it would be a good place for me to start learning shaders.
So is there any way for you to help me with this?

14
BTW, below's the real code responsible for this.

15
Yes, but when I draw a 100 lights, this is what I get: (screenshot attached)
It gets even worse with 500 lights, where the framerate drops to 40.

Pages: [1] 2
anything