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

Login with username, password and session length

 
Advanced search

1343045 Posts in 61492 Topics- by 53034 Members - Latest Member: io-games

July 18, 2018, 08:11:47 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsMidnight Radio - A game about being a photojournalist
Pages: 1 [2]
Print
Author Topic: Midnight Radio - A game about being a photojournalist  (Read 3528 times)
MidnightRadio
Level 0
**



View Profile WWW
« Reply #20 on: August 18, 2017, 03:53:08 AM »

So it seems that many people are having problems to achieve good post-processing effects in Unity, like the Bokeh effect, so I updated the devlogs to show them how I did it. Good luck with your games  Coffee
Logged

Midnight Radio - A game about being a photojournalist
TheGiant
Level 0
**



View Profile
« Reply #21 on: August 19, 2017, 11:55:49 AM »

So it seems that many people are having problems to achieve good post-processing effects in Unity, like the Bokeh effect, so I updated the devlogs to show them how I did it. Good luck with your games  Coffee

Thank you Wink
Logged
MidnightRadio
Level 0
**



View Profile WWW
« Reply #22 on: August 26, 2017, 08:09:32 AM »

Devlog 8

Now the news program will know what you photograph and how. For example, if you photograph a document, but you are too far or the document is covered by other objects or something, the news program will tell you. Example:







How I did it? First of all I put some "markers" in the objects that are relevant for the photography (in this case, the document):



Those "markers" are just cubes with a box collider component and set to be in a layer called "ScreenInfo". Of course they are not rendered. They are useful because they allow you tu know which parts of the document appear in the photograph. If we had only into account the whole object (the document), the game would only know if the document appears in the photograph, but not how much of it. So what I do is check if those "markers" appear in the screen and then create an answer based on that.

But, how do you know if a certain object is in the screen in Unity? First I use GeometryUtility.CalculateFrustumPlanes and GeometryUtility.TestPlanesAABB to know if the object is within the screen bounds. Then, I perform a Physics.Raycast from the camera to the object to see if there is an object in front of it. If there is one, then the object is not in the screen.

I also used Physics.OverlapSphere in order to only perform those checks over the objects of the layer "ScreenInfo".

This is a simplification of my code so you can use it directly in your projects:

Code:
public void GetPhotoInfo()
    {
        Plane[] planes = GeometryUtility.CalculateFrustumPlanes(camera);
        Collider[] hitColliders = Physics.OverlapSphere(camera.transform.position,
            1000000000000,
            1 << LayerMask.NameToLayer("ScreenInfo"));

        foreach(Collider collider in hitColliders)
        {
            if (IsWithinScreenBounds(planes, collider))
             {
                GameObject gameObject = collider.gameObject;

                Vector3 dir = gameObject.transform.position - camera.transform.position;
                RaycastHit hitInfo;
                if (Physics.Raycast(camera.transform.position, dir, out hitInfo))
                {
                    if(hitInfo.collider.gameObject == gameObject)
                    {
                        //Do your cool stuff here
                    }
                }
           
            }

        }
    }

    private bool IsWithinScreenBounds(Plane[] planes, Collider gameObjectCollider)
    {
        if (GeometryUtility.TestPlanesAABB(planes, gameObjectCollider.bounds))
            return true;
        else
            return false;
    }

Of course my method is not perfect, but it works very well if you don't have objects of strange forms in front of the object you want to photograph.

As always, if you have any doubt, don't hesitate to send me an email or whatever  Coffee
Logged

Midnight Radio - A game about being a photojournalist
MidnightRadio
Level 0
**



View Profile WWW
« Reply #23 on: September 03, 2017, 10:04:09 AM »

Devlog 9

I created a computer in which you can read the news of the newspaper and do other things just by moving the mouse and clicking. I also changed the storyline a little bit so now you will work for a digital newspaper instead of a tv news program.

Logged

Midnight Radio - A game about being a photojournalist
MidnightRadio
Level 0
**



View Profile WWW
« Reply #24 on: October 27, 2017, 01:10:21 AM »

Devlog 10

I have created more content for the game (roads, places, etc.). The first part of the game, which will be available in the demo, is almost finished. Hope I can create the demo and a trailer soon. I will also create a Kickstarter campaign.

Take a look at the first version of the city:


Logged

Midnight Radio - A game about being a photojournalist
Superb Joe
Level 10
*****



View Profile
« Reply #25 on: October 27, 2017, 01:33:59 AM »

cool. nightcrawler was so good.
Logged
BSInf
Level 0
*


View Profile
« Reply #26 on: November 03, 2017, 08:14:53 AM »

ok, now I'm on the hype train!! waiting for the playable version!!
Logged
MidnightRadio
Level 0
**



View Profile WWW
« Reply #27 on: November 13, 2017, 05:00:42 AM »

cool. nightcrawler was so good.

ok, now I'm on the hype train!! waiting for the playable version!!

Thank you guys!
Logged

Midnight Radio - A game about being a photojournalist
Pineapple
Level 10
*****


~♪


View Profile WWW
« Reply #28 on: November 13, 2017, 05:48:17 AM »

this looks really good! I want to play this
Logged
MidnightRadio
Level 0
**



View Profile WWW
« Reply #29 on: November 21, 2017, 02:24:59 AM »

this looks really good! I want to play this

Thank you! The demo will be available soon I hope.
Logged

Midnight Radio - A game about being a photojournalist
Pages: 1 [2]
Print
Jump to:  

Theme orange-lt created by panic