Skip to content

Instantly share code, notes, and snippets.

View semagnum's full-sized avatar
🎯
Focusing

Spencer Magnusson semagnum

🎯
Focusing
View GitHub Profile
@esnosy
esnosy / read_render_result.py
Last active February 26, 2024 10:28
Read render result (or any image) in Blender fast
# Reading from render result without heavy workarounds
# Supports 2.93
# Author Iyad Ahmed (Twitter: @cgonfire, email: iyadahmed@cgonfire.com)
# Licensed under GPL-3
import bgl
import bpy
import gpu
import numpy as np
# NOTE: changing texture dimensions shouldn't affect vector scope/histogram much
V3D_IMAGE_WIDTH = 512 # region.width
V3D_IMAGE_HEIGHT = 512 # region.height
offscreen = gpu.types.GPUOffScreen(V3D_IMAGE_WIDTH, V3D_IMAGE_HEIGHT)
# TODO: apply srgb to frambebuffer color transform
def view3d_to_texture(region, space_data):
"""Render 3D View to Texture"""
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# --------------------------LIBRERIAS-------------------------- #
# ------------------------------------------------------------- #
import numpy as np
# ------------------------------------------------------------- #
# -------------------------FUNCIONES--------------------------- #
def generate_random_points_2D(num_puntos, media, mat_cov):
aux_arr = []
for i in range(num_puntos):