ray

【Ray Tracing The Next Week 超详解】 光线追踪2-4 Perlin noise

流过昼夜 提交于 2021-02-14 15:53:16
Preface 为了得到更好的纹理,很多人采用各种形式的柏林噪声(该命名来自于发明人 Ken Perlin) 柏林噪声是一种比较模糊的白噪声的东西:(引用书中一张图) 柏林噪声是用来生成一些看似杂乱无章其实有些变换规律的图形(更加贴近自然),比如海水、地形、雾等 当然这里面的原理涉及分形几何等相关的知识 例如,2D柏林噪声可以生成 以及一些网上的总结: 还有一些其他的图 是不是看起来自然多了 那么今天,我们就来 领略一下随机技术带来的自然之美~ Chapter 4:Perlin Noise 柏林噪声有2个关键的特点: 第一,输入相同的3D点,总能返回相同的随机值 第二,简单快捷,使用一些hack的方法,达到快速近似的效果。 关于随机数: 许多人在他们的程序中使用“随机数产生器”,以使得物体的运动行为更加自然,或者用来生成纹理。随机数产生器在一些情况下很有用,比如用在模拟自然物体的地方,如地形,海水等。 自然物体通常是分形的,有各种各样的层次细节,比如山的轮廓,通过高度区分就有高山(mountain,高度变化大)、山丘(hill,高度变化适中)、巨石(高度变化小) 、石头(高度变化很小)等。另外,比如草地、海浪、跑动的蚂蚁、摇晃的树枝、风、大理石的花纹等等,这些都呈现出了或大或小的细节变化。Perlin噪声函数通过噪声函数来模拟这些自然景观。 要构造一个Perlin函数,首先需要一个

【Ray Tracing The Next Week 超详解】 光线追踪2-3

那年仲夏 提交于 2021-02-14 15:26:51
Preface 终于到了激动人心的纹理章节了 然鹅,看了下,并不激动 因为我们之前就接触过 当初有一个 attenuation 吗? 对了,这就是我们的rgb分量过滤器,我们画出的红色、蓝色、绿色等等,都是通过它来控制的 专业点的词语叫做rgb衰减比例,比如rtvec(1.,0.,0.),最后呈现出来的是红色,因为r保留了100% 它是怎么控制的呢,我们来回顾一下这个过程 首先,我们创建一个材质球 后面那个rtvec(0.4,0.2,0.1)就是衰减比例(衰减到原来的百分之。。) 之后 进入数据成员中, 之后主函数调用lerp的时候 info.materialp->scatter(sight, info, attenuation, scattered)) 球体的材质调用scatter函数 即: 没有丝毫改动地有数据成员传递到了attenuation 中 然后用attenuation 做乘法进行rgb衰减,递归就不用说了吧,最后递归到深处为黑色,不然为背景色 为什么要在前言将这个东东,因为 attenuation 所控制形成的物体表面颜色就是最简单的纹理 说白了这章比较简单,因为下一章是这本书的另外一个高难度章节(分别分布于第二章和第四章) 所以,中间第三章来点简单好玩的,过渡一下 先看效果 Chapter 3:Solid Textures 废话不多说,先写一个纹理类 ///

How can I use the python logging in Ray?

♀尐吖头ヾ 提交于 2021-02-07 13:19:33
问题 I use the logging module in the main function/process, it works well, but it seems can't work in Actor process/subprocess. How to make it work? In the sample below code, logging.info work in the main process but failed in the worker process. Thanks. import logging import ray @ray.remote class Worker(object): ... def train(self): logging.info("fail print") ... worker = Worker.remote() ray.get(worker.train.remote()) logging.info("successful print") 回答1: There are a couple things to be careful

Brightcove喜获两项技术与工程艾美奖

纵然是瞬间 提交于 2021-01-31 14:46:01
视频行业领先企业因对行业做出的基础性贡献和技术上的持续创新而获奖 波士顿--(美国商业资讯)--全球商业视频行业领先企业 Brightcove Inc. (NASDAQ:BCOV)今天宣布,公司获得由美国国家电视艺术与科学研究院(NATAS)颁发的两项技术与工程艾美奖(Emmy® Awards),以表彰其在工程创新方面的杰出贡献。这两个最新奖项将让公司在行业内的领导地位进一步巩固。值得一提的是,在获奖者中,Brightcove是唯一一家因杰出的视频服务而获奖的在线视频平台。 凭借卓越的性能及工程创新性,Brightcove的Context Aware Encoding技术斩获“视频编码优化感知指标开发”(Development of Perceptual Metrics for Video Encoding Optimization)类别的艾美奖。这项技术使客户能够分发以高视觉质量编码的视频,同时还能最大限度降低网络带宽和存储成本。 此外,Brightcove的Zencoder和Video Cloud产品在“大规模处理优化压缩技术开发”(Development of Massive Processing Optimized Compression Technologies)类别中获表彰。该奖项旨在表彰Brightcove在大规模视频转码工作流程设计方面的创新工作

Script breaks out of function after sending a few packets

孤街浪徒 提交于 2021-01-29 20:43:52
问题 I am writing a python program that sends packets for a specified amount of time. The sending script: import socket import time import networkparam import ray ray.init() transformer_sending_time = 0 final_message_sent = False @ray.remote def send_message(): """ Sends an abnormal measurement to the specified ip address or port number given by the networkparam module Parameters ---------- None, however we can consider the definitions in networkparam as the function args Returns ---------- None "

Error: `callbacks` must be a callable method that returns a subclass of DefaultCallbacks, got <class 'ray.rllib.agents.callbacks.DefaultCallbacks'>

亡梦爱人 提交于 2021-01-29 18:30:36
问题 when I run some codes(DDPG - Deep Deterministic Policy Gradient), this error occurred: ValueError: callbacks must be a callable method that returns a subclass of DefaultCallbacks, got <class 'ray.rllib.agents.callbacks.DefaultCallbacks'> my code is here: import json def load_policy(): log_dir = "/root/ray_results/DDPG_SimpleSupplyChain_2020-07-15_02-37-48j2fjk67_" # this path needs to be set manually checkpoint_id = "200" with open(f"{log_dir}/params.json", "r") as read_file: config = json

How to ensure each worker use exactly one CPU?

大憨熊 提交于 2021-01-29 12:57:49
问题 I'm implementing SEED using ray, and therefore, I define a Worker class as follows import numpy as np import gym class Worker: def __init__(self, worker_id, env_name, n): import os os.environ['OPENBLAS_NUM_THREADS'] = '1' self._id = worker_id self._n_envs = n self._envs = [gym.make(env_name) for _ in range(self._n_envs)] def reset_env(self, env_id): return self._envs[env_id].reset() def env_step(self, env_id, action): return self._envs[env_id].step(action) Besides that, there is a loop in the

How to ensure each worker use exactly one CPU?

走远了吗. 提交于 2021-01-29 12:17:47
问题 I'm implementing SEED using ray, and therefore, I define a Worker class as follows import numpy as np import gym class Worker: def __init__(self, worker_id, env_name, n): import os os.environ['OPENBLAS_NUM_THREADS'] = '1' self._id = worker_id self._n_envs = n self._envs = [gym.make(env_name) for _ in range(self._n_envs)] def reset_env(self, env_id): return self._envs[env_id].reset() def env_step(self, env_id, action): return self._envs[env_id].step(action) Besides that, there is a loop in the

How do I make ray.tune.run reproducible?

无人久伴 提交于 2021-01-29 07:40:10
问题 I'm using Tune class-based Trainable API. See code sample: from ray import tune import numpy as np np.random.seed(42) # first run tune.run(tune.Trainable, ...) # second run, expecting same result np.random.seed(42) tune.run(tune.Trainable, ...) The problem is that tune.run results are still different, likely reason being that each ray actor still has different seed. Question : how do I make ray.tune.run reproducible? 回答1: (This answer focuses on class API and ray version 0.8.7. Function API

How do I make ray.tune.run reproducible?

妖精的绣舞 提交于 2021-01-29 07:36:28
问题 I'm using Tune class-based Trainable API. See code sample: from ray import tune import numpy as np np.random.seed(42) # first run tune.run(tune.Trainable, ...) # second run, expecting same result np.random.seed(42) tune.run(tune.Trainable, ...) The problem is that tune.run results are still different, likely reason being that each ray actor still has different seed. Question : how do I make ray.tune.run reproducible? 回答1: (This answer focuses on class API and ray version 0.8.7. Function API