Jump to content


Photo

2D Lighting Normal From 3D Models D3D22D


  • Please log in to reply
7 replies to this topic

#1 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 30 October 2013 - 12:07 AM

https://skydrive.liv...45D1EA9168D!675


Model Loaded 
screenshot100.jpg

3d Lighting On for quick verification
screenshot101.jpg

Converted to 2d light map image
screenshot102.jpg

Result in shader
result.png

presteps
a ) Open your obj file in GMModelFix
http://gmc.yoyogames...howtopic=397461
b ) Use the FIX tool
c ) use the rotate feature so the model faces right (on the +x) side and that the top of the model (or the side of the model that will face the camera) points up towards +z
d ) scale and move the object so it is centered
d ) open the texture and use the flip feature until the texture matches the model, make sure the model is set to show the texture to do this
e ) save the texture
f ) hit the generate lighting button
h ) confirm the model is properly lighted by adding a light in the viewer
i ) save the model
*refer to the GMModelFix topic and also the help in the program (F1)
 
steps
1) open the d3d model in d3d22d
2) open the texture
3) scale the model to fit in the 512x512 window and to be the wanted size for your game (can be done in GMModelFix or Studio's sprite editor)
4) hit S
5) Select all in paint and copy
6) Paste in a sprite and delete the background in Studio, and crop. This will be your actual sprite.
7) In d3d22d, Select the Convert to 2d Lighting Normal
8) hit S
9) Select all in paint and copy
10) paste in a sprite and delete the background in Studio, and crop. This will be your 2d normal sprite.
 
compatible with these shaders
http://gmc.yoyogames...howtopic=589259

http://gmc.yoyogames...howtopic=586231


If the lighting in the shader clips, increase the z position  (currently 3) to 100;
if the result does not work at all, make sure to set the Use as 3d for the 2 sprites involved and possibly set the Force software vertex in the game setting. This mostly for us guys on windows 8.1. Studio is totally fubar on 8.1; these 2 settings being required, it is almost impossible to distribute a game like that, imagine all the texture swapping your game will have to do!!?? And you thought the shader stuff would make things faster?? think again. you have to cripple your game to make the shaders work lol.

Edited by icuurd12b42, 14 November 2013 - 12:13 PM.

  • 4

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#2 japjap

japjap

    GM-LINUX GM-PS4 user

  • GMC Member
  • 166 posts
  • Version:GM8

Posted 30 October 2013 - 01:23 PM

I know you say it's 2d. But I hope you made my dream come true. Are these the shaders we could not do with gm8?


Edit: To bad. I just read the whole thing again. This is not real shader effect.
I always wanted the background to reflect (like a mirror effect) on the 3d object.

Edited by japjap, 30 October 2013 - 01:24 PM.

  • 0

#3 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 30 October 2013 - 06:27 PM

What to you mean not real shader effect? It is really 2d normal mapping! The shaders exist they are real! (LOL)
  • 3

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#4 TheSnidr

TheSnidr

    Heavy metal viking dentist

  • GMC Elder
  • 3345 posts
  • Version:GM:Studio

Posted 30 October 2013 - 06:30 PM

Ooh, great idea! This will really allow for some pretty advanced 2D lighting effects! I love it!
  • 0

#5 xot

xot

    GMC Dismember

  • GMC Elder
  • 4785 posts
  • Version:GM:Studio

Posted 31 October 2013 - 02:52 AM

Very nice to be able to do this with models we may already be using in GM. Good work. :)
  • 0
GMLscripts.com, rise from your grave!

If any of my posts contain broken images or links, I can probably supply them for you. PM with a link to the post.

#6 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 31 October 2013 - 04:26 AM

I downloaded a lot of models from here
http://tf3dm.com/

Many obj models have single textures there and are easily loaded in gmmodelfix

Many non obj models are also available and using accutrans 3d (non crippled shareware) to export to obj and then import into gmmodelfix

Of course blender or anim8or if you dont want to loose you mind, is a good way to make 3d object. Anim8or is what I used for the example

Edited by icuurd12b42, 31 October 2013 - 09:24 AM.

  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button


#7 xygthop3

xygthop3

    You may know me from such forums as "Shaders"

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

Posted 31 October 2013 - 05:14 AM

This is really an excellent tool and will help a lot of people (including me) to create some great effects.

 

As for specular maps I'm tempted to look in to how to create one from within GM by passing the diffuse texture only, but for now I use CrazyBump  to create them to be using in the shader.

http://www.crazybump.com/


  • 0

#8 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 18181 posts
  • Version:GM:Studio

Posted 31 October 2013 - 09:20 AM

The best way for specular is to do it manually and properly. though on a small image it's pretty useless.
http://www.youtube.c...h?v=5Gqp4bNJ52M

also with the tool, you can turn the texture back on after you made the normals. it will mix with the normals and make a bump mapish specularish effect.
  • 0

gmcbanner.pnggmcbanner_tools.png

ICU Live Tutoring Through Slack or Skype | My Tools Page follow.png

I FRANTICALLY MADE MY 18000 POST TOPIC BEFORE MIKE ANNOUNCED A DELAY...
Now I'm squirming not to hit that reply button