Jump to content
Message added by TopicLocker3000

This topic was automatically locked after 6 months of inactivity. If you are the topic owner, please contact a moderator to have it unlocked.

Recommended Posts

Technical Cover o' Topics

So first off this has probably been already suggested in which I apologize, but I know it has not yet been technically covered in how you would pull this off in gamemaker.  Also, I don't know what variables are set to but I'm sure they can be modified;) .
 
So you need to start off with 2 objects:
Camera (which has already been established)
&
Lens Flare (possibly this could be squeezed in with some other objects, but the overall effect wouldn't be the same)
 
Lens Flare (I will only be covering this)
Create Event:

global.rsunX = 0;
global.rsunY = -0.9;
global.rsunZ = 0.4;
global.angle = radtodeg(arctan(global.rsunZ/global.rsunY));
global.drawFlare = true;

Draw Event:

d3d_set_projection_ortho(0,0,640,480,0);
d3d_set_hidden(false);
if (global.drawFlare = true) {
d3d_convert_to_2d(objCamera.xf,objCamera.yf,objCamera.zf,
                  objCamera.xt,objCamera.yt,objCamera.zt,
                  0,0,1,45,640/480,
                  objCamera.xf+global.rsunX,objCamera.yf+global.rsunY,objCamera.zf+global.rsunZ);

a = 1-(point_distance(view_wview/2,view_hview/2,sunx,suny)/100);
draw_set_alpha(a);
draw_rectangle(0,0,641,481,false);
draw_set_alpha(1);
draw_set_blend_mode_ext(2,4);
draw_sprite_ext(sprSun,0,sunx,suny,2,2,0,c_white,a);
draw_set_blend_mode(bm_normal);

a = 1-(point_distance(view_wview/2,view_hview/2,sunx,suny)/500);

draw_flare(2,0.35,0.35,make_color_rgb(80,60,20));
draw_flare(1,0.39,0.1,make_color_rgb(60,50,20));
draw_flare(1,0.43,0.07,make_color_rgb(50,40,10));
draw_flare(2,0.65,0.1,make_color_rgb(40,30,100));
draw_flare(0,0.9,0.03,make_color_rgb(0,30,180));
draw_flare(2,1,0.35,make_color_rgb(80,60,20));
draw_flare(0,1.05,0.05,make_color_rgb(0,180,30));
draw_flare(1,1.65,0.7,make_color_rgb(30,20,10));
draw_flare(3,2,1.5,make_color_rgb(15,10,5));
}

d3d_set_hidden(true);

d3d_convert_to_2d script :

{
  //A very nice (and complicated) script made by Yourself
  var px,py,pz,dx,dy,dz,uX,uY,uZ,vX,vY,vZ,mm;

  dX = argument3-argument0;
  dY = argument4-argument1;
  dZ = argument5-argument2;
  mm = sqrt(dX*dX+dY*dY+dZ*dZ);
  dX /= mm;
  dY /= mm;
  dZ /= mm;

  uX = argument6;
  uY = argument7;
  uZ = argument8;
  mm = uX*dX+uY*dY+uZ*dZ;
  uX -= mm*dX;
  uY -= mm*dY;
  uZ -= mm*dZ;
  mm = sqrt(uX*uX+uY*uY+uZ*uZ);
  uX /= mm;
  uY /= mm;
  uZ /= mm;

  tFOV = tan(argument9*pi/360);
  uX *= tFOV;
  uY *= tFOV;
  uZ *= tFOV;

  vX = uY*dZ-dY*uZ;
  vY = uZ*dX-dZ*uX;
  vZ = uX*dY-dX*uY;
  vX *= argument10;
  vY *= argument10;
  vZ *= argument10;
  
  pX = argument11-argument0;
  pY = argument12-argument1;
  pZ = argument13-argument2;

  mm = pX*dX+pY*dY+pZ*dZ;
  if (mm > 0) {
     pX /= mm;
     pY /= mm;
     pZ /= mm;
  } else {sunx = -40000; suny = -40000; return 0; }

    mm = (pX*vX+pY*vY+pZ*vZ)/sqr(argument10*tFOV);
    sunx = (mm+1)/2*window_get_width();
    mm = (pX*uX+pY*uY+pZ*uZ)/sqr(tFOV);
    suny = (1-mm)/2*window_get_height();
}

draw_flare script:

rc = view_wview/2;
rm = view_hview/2;
k = argument1;
xx = sunx+(rc-sunx)*argument1; yy = suny+(rm-suny)*argument1;
draw_set_blend_mode(bm_add);
s = argument2*(50/(48+random(2)))
draw_sprite_ext(sprFlare,argument0,xx,yy,s,s,0,argument3,a);
draw_set_blend_mode(bm_normal);

Image

sun0828-lensflare-1.jpg

This is what the final product should look like depending on what sprite you use.

Edited by x33perking
Link to post
Share on other sites

I've used this concept in my *fake* Mine-imator 1.0.0 Full Super Duper Shuper Edition with Premium Minecraft topic, and seeing it inside the real Mine-imator would be epic.

 

 

I SUPPORT

Good good you have also, fallen for my TRICK!

Link to post
Share on other sites

Sounds good although it could be easily done with a secondary editing software so idk if it would be added.

Pfffffff..... Secondary!  This is the only software I will ever use!

Welp. I'll wait for Davve's response. Also what do you mean by "trick"?

You know the trick.  The one that I have done.

Link to post
Share on other sites

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...