Skip to content

Instantly share code, notes, and snippets.

View marcosbitetti's full-sized avatar

Marcos Augusto Bitetti marcosbitetti

View GitHub Profile
@marcosbitetti
marcosbitetti / grid-slicer.py
Last active August 2, 2025 18:41
This tool get a large terrain on Blender, and create thin objects from it. Slicing original object. Useful to make game levels, spliting a huge scene and optimize each slice for LOD
import bpy
import bmesh
from mathutils import Vector
def slice_object_by_grid(obj_name, cell_size_x=5.0, cell_size_y=5.0):
"""
Slices a mesh object into new objects based on a grid.
Considers faces if *any* of their vertices fall within the grid cell.
Args:
@marcosbitetti
marcosbitetti / frame_renderer.gd
Last active March 18, 2019 14:31
Godot 3.x frame render to video editor
##############################################
#
# Author: NerdOfTheMountain (Marcos A. Biteti - https://github.com/marcosbitetti)
#
# This work is licensed under a Creative Commons Attribution 4.0 International License.
#
# USAGE:
# 1. Attach this script in a AnimationPlayer node
# 2. Set animation name and optionally framerate in properties editor
# 3. In project setthings choose: fullscreen = true, stretch mode = viewport and apect=igonre
@marcosbitetti
marcosbitetti / godot.gitignore
Created October 16, 2016 00:22
gitignore for Godot
*~
*.swp
*.swo
.fscache
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
@marcosbitetti
marcosbitetti / version_controll_addon.gd
Created October 15, 2016 21:32
A version control helper to using in Godot Engine
##
# Automatic versioning the code using GIT
# need GIT instaled on OS
func _dev_auto_commit():
if OS.is_debug_build():
var path = '/usr/bin/git'
var finder = File.new()
if not finder.file_exists(path):
if finder.file_exists('/usr/sbin/git'):
path = '/usr/sbin/git'
@marcosbitetti
marcosbitetti / gist:ef2f425066fb2e05755fe5f8d199c60f
Created April 11, 2016 10:19
Simple Faster Blur for Godot Shader
// VERTEX SHADER
uniform vec2 screen_size = vec2(1280,800);
VAR1 = vec4(1.0/screen_size.x,1.0/screen_size.y,0.0,0.0);
// FRAGMENT SHADER
vec3 sc =
texscreen( vec2(SCREEN_UV.x-VAR1.x*4.0, SCREEN_UV.y-VAR1.y*4.0) ) * 0.0162162162 +
texscreen( vec2(SCREEN_UV.x-VAR1.x*3.0, SCREEN_UV.y-VAR1.y*3.0) ) * 0.0540540541 +
extends Spatial
var camera = Camera.new()
var cam_offset
func _process(delta):
if get_parent().get_viewport().get_camera().get_global_transform().basis.z.dot(get_global_transform().origin)>0:
return
///// ----------- Fragment
uniform texture diffuse;
uniform texture normal;
vec4 cor = tex(diffuse,UV);
vec3 norm = 2.0 * tex(normal,UV).rgb;// - vec3(0.5,0.5,0.5);
DIFFUSE = cor.rgb;
NORMAL = NORMAL*norm;
@marcosbitetti
marcosbitetti / gist:29563e142f0c01b2fa27
Last active January 8, 2017 17:06
MatCap shader prototype for Godot
// Vertex
VAR1 = vec4(normalize(MODELVIEW_MATRIX * VERTEX), 1.0);
// Fragment
uniform texture matcap;
vec3 r = reflect(VAR1.xyz, NORMAL);
float m = 2.0 * sqrt( pow( r.x, 2.0 ) + pow( r.y, 2.0 ) + pow( r.z + 1.0, 2.0 ) );
@marcosbitetti
marcosbitetti / gist:f9485398cc800c11bd87
Created April 10, 2015 20:02
Jade, Stylus and Coffeescript environment develompent server
#!/usr/bin/env python
import BaseHTTPServer
import SimpleHTTPServer
import time,os,sys
import SocketServer
import io,os,sys,re,fnmatch
import subprocess
@marcosbitetti
marcosbitetti / gist:cb9a6539476cb0741b77
Last active August 29, 2015 14:17
shell to split a skycube generated in Blender to 6 files to use in skycube game environments
#!/bin/bash
#########################################################################
# crop_sky.sh #
#########################################################################
# This file is part of: #
# WILD WITCH PROJECT #
# http://www.wildwitchproject/ #
#########################################################################
# CC-BY-SA #
# Wild Witch Project by Marcos Augusto Bitetti is licensed under a #