Jump to content


Photo

Realistic And Fake Reflections.


  • Please log in to reply
11 replies to this topic

#1 japjap

japjap

    GM-LINUX GM-PS4 user

  • GMC Member
  • 166 posts
  • Version:GM8

Posted 14 December 2011 - 05:42 PM

Realistic or fake reflections.
It impossible to find any realistic reflection sample in pure GML.
It is very rare to find any fake reflection sample in pure GML.
You understand this post lacks 500 samples. So we do wish to see as much as possible samples.
Post you reflection samples here.

What is reflection or a shader?
Reflection on an object which is caused by little bit of mirroring the background, shadows and picking up the lights from the area which makes the object look life.
sa3.png
The above car without the reflections would not look cool. Our goal is to create something similar as this with 100% pure GML.

In this topic we will display all samples that work without any extension:


Fake reflections:

Sky reflecting on a car by JAPJAP & Pércsich Zoltán
http://www.mediafire...q591397hhnnm7c0
This is a beginners sample which shows you how to make a fake sky reflection.
557a423c86.png


Sky reflecting on a car V2 by JAPJAP & Pércsich Zoltán fixed by YellowAfterlife
http://solidfiles.com/d/eaf2aae5f3/
This is a much better file which shows you how to make a fake sky reflection.
9ec94e6768.png


A shining light reflecting on ninja stick By TheSnidr
http://www.host-a.ne...shinyobject.zip
This is a very good looking fake light reflection effect on a ninja club.
shinye.jpg

Sphere-mapping sample by Gameer3D
http://www.mediafire...g2q7t0zn2iwibvz
This sample shows how to sphere map in GM.
No image yet.


Real reflections:
It seems nobody posted a sample yet do you want are to be the first? The one that posts real reflection samples will become the star of the community.

Edited by japjap, 01 November 2013 - 10:23 PM.

  • 0

#2 ean

ean

    GMC Member

  • New Member
  • 190 posts
  • Version:GM8

Posted 14 December 2011 - 06:20 PM

using primitives in theory you'd calculate the normal for every triangle and compute the UV's from that. Good luck with doing that manually, I don't the Find and Replace feature is advanced enough for that either.
  • 0

#3 Nebuer

Nebuer

    GMC Member

  • GMC Member
  • 21 posts

Posted 15 December 2011 - 04:57 AM

I had the idea of using a zbrush matcap like approach to render objects

my method involved pre calculating the vertex normals (or face normals) combing it with the camera's orientation, then finding the appropriate colour to render the vertex from a look up table, generated from a 2d image of a prerendered sphere.
It did look cool but more than 50-ish polygons lagged my pc out because it's a **** computer and i'm not the best programmer, so it wasn't of much use

like this (my method would require a higher poly model to look as good)
http://i43.tinypic.com/nn1eg6.png
this was rendered with 'sculptris' which can render millions of poly's with these matcap things at 60fps+ on really **** computers, so in theory this could be a very fast way to face reflections, and any sort of texture that would take longer to render realtime.

i do plan on trting again one day when i'm a little more experience with gml

EDIT: if i find it i'll upload it

Edited by Nebuer, 15 December 2011 - 04:58 AM.

  • 0

#4 Gamer3D

Gamer3D

    Human* me = this;

  • GMC Member
  • 1819 posts
  • Version:GM:Studio

Posted 15 December 2011 - 06:05 AM

Sky reflecting on a car by JAPJAP & Pércsich Zoltán
http://www.mediafire...q591397hhnnm7c0

All that fuss about realism, and you were thinking of this. You need to explain that you want a VERY fake looking reflection.

Real reflections:
It seems nobody posted a sample yet are willing to be the first?


Sure. Why not. Don't expect expect to be able to use it for anything in the mid-high polygon range in real time. Give me a bit to make sure it has comments and upload it. I'll edit this post once that is done.

Here you go. Sphere-mapping in GM. Also demonstrates how to apply a specular map using blend modes.

EDIT: Sorry about the bad link. I clicked the wrong "get link" button.

Edited by Gamer3D, 15 December 2011 - 06:19 PM.

  • 0

#5 YellowAfterlife

YellowAfterlife

    GMC Member

  • Global Moderators
  • 4011 posts
  • Version:GM:Studio

Posted 15 December 2011 - 06:39 AM

To make things clearer...

How example 1,

Sky reflecting on a car by JAPJAP & Pércsich Zoltán
http://www.mediafire...q591397hhnnm7c0

, looks like:
Posted Image
Spoiler

How it can be edited to look like:
Posted Image
Spoiler

Download edited version: (link)

Gamer3D: small exe?
  • 1

#6 Gamer3D

Gamer3D

    Human* me = this;

  • GMC Member
  • 1819 posts
  • Version:GM:Studio

Posted 15 December 2011 - 07:39 AM

Small exe of the example I gave previously.
  • 0

#7 japjap

japjap

    GM-LINUX GM-PS4 user

  • GMC Member
  • 166 posts
  • Version:GM8

Posted 15 December 2011 - 05:11 PM

To make things clearer...

How example 1,


Sky reflecting on a car by JAPJAP & Pércsich Zoltán
http://www.mediafire...q591397hhnnm7c0

, looks like:
Posted Image
Spoiler

How it can be edited to look like:
Posted Image
Spoiler

Download edited version: (link)

Very good.


like this (my method would require a higher poly model to look as good)
Posted Image
EDIT: if I find it i'll upload it

It looks very impressive. We have the worlds greatest scientist, engineers and politicians in this community with super fast computers. I hope you find it and upload it here. It looks useful.

Small exe of the example I gave previously.

This is not a sample this is some sort of converter. I converted a OBJ file with this. Now how am I supposed to get reflection with this in GM. Please add some instructions and screen shots for noobs like me.
  • 0

#8 ean

ean

    GMC Member

  • New Member
  • 190 posts
  • Version:GM8

Posted 15 December 2011 - 06:14 PM

I think you clicked on

Here you go. Sphere-mapping in GM. Also demonstrates how to apply a specular map using blend modes.

Instead of

Small exe of the example I gave previously.

Now, that's a nice reflection. For it to work on a car you'd have to create a model import program that exported a text containing the model data integrated with get_spheremap_uv. Because I don't think Find and Replace would be enough.

Edited by ean, 15 December 2011 - 06:19 PM.

  • 0

#9 Gamer3D

Gamer3D

    Human* me = this;

  • GMC Member
  • 1819 posts
  • Version:GM:Studio

Posted 15 December 2011 - 06:21 PM

This is not a sample this is some sort of converter. I converted a OBJ file with this. Now how am I supposed to get reflection with this in GM. Please add some instructions and screen shots for noobs like me.

Sorry about that. I clicked the wrong button, got the wrong link. That was a program made for an entirely different problem.


I think you clicked on

Here you go. Sphere-mapping in GM. Also demonstrates how to apply a specular map using blend modes.

Instead of

Small exe of the example I gave previously.

He has a point though. I should have had the correct link the first time.

EDIT: Before I stop posting (I think I've posted everything I need), I should note that the following can be made into models for speed: Specular map, Diffuse map. The spherical environment map cannot be made into a model as it is view-dependent. This is why good reflections in GM are nothing but fantasy so far.


EDIT 2 (in reply to "Now, that's a nice reflection. For it to work on a car you'd have to create a model import program that exported a text containing the model data integrated with get_spheremap_uv. Because I don't think Find and Replace would be enough."): You would need to get a model imported, but you could make it work on an arbitrary model using a for-loop or similar.

Edited by Gamer3D, 15 December 2011 - 06:26 PM.

  • 0

#10 japjap

japjap

    GM-LINUX GM-PS4 user

  • GMC Member
  • 166 posts
  • Version:GM8

Posted 16 December 2011 - 10:55 AM


This is not a sample this is some sort of converter. I converted a OBJ file with this. Now how am I supposed to get reflection with this in GM. Please add some instructions and screen shots for noobs like me.

Sorry about that. I clicked the wrong button, got the wrong link. That was a program made for an entirely different problem.

Sorry about that I posted the wrong link.

This is also a fake relection not a real reflection. Please post a screenshot of this.
  • 0

#11 TheSnidr

TheSnidr

    That guy

  • Global Moderators
  • 3024 posts
  • Version:GM:Studio

Posted 16 December 2011 - 12:33 PM

If it truly is "real" reflections you want, check out my topic: http://gmc.yoyogames...1
There we discussed some pros and cons. Also, Brac37 uploaded his mirror example, look for his post. If you feel like working your ass off for incredibly low fps, copy the method to every vertex of the model, and you'll have true reflections.

Edited by TheSnidr, 16 December 2011 - 05:54 PM.

  • 0

#12 Gamer3D

Gamer3D

    Human* me = this;

  • GMC Member
  • 1819 posts
  • Version:GM:Studio

Posted 16 December 2011 - 06:32 PM

This is also a fake relection not a real reflection. Please post a screenshot of this.

That is how many modern games use reflections, with a few caveats. Modern games (usually) use cube maps, and calculate the UV on a per-pixel basis. The reason cube-mapping won't be feasible for GM is that the triangles may span multiple faces of the cubemap. In this case, you'll need to split the triangle into several more (same shape, but each triangle occupying one face of the cube-map), which is an expensive operation to perform on a per-triangle basis, and even more so in GM.

If it truly is "real" reflections you want, check out my topic: http://gmc.yoyogames...1
There we discussed some pros and cons. Also, Brac37 uploaded his mirror example, look for his post. If you feel like working your ass off for incredibly low fps, copy the method to every vertex of the model, and you'll have true reflections.

Even then, it'll still be fake if you're using smooth shading, due to the location of the mirrored camera needing to change as the normal it is reflected over changes. For true reflection, you'll need to do this on each pixel, but then you might as well go for full-on raytracing.

Of course, if you're intending to have flat-looking polygons (Such as the latest version of the Batmobile), go for it.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users